Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript How to get js(jQuery) to generate dynamic code

  • This topic is empty.
Viewing 2 posts - 16 through 17 (of 17 total)
  • Author
    Posts
  • #207952
    amanda_
    Participant

    Uh oh, encountered another hiccup. It’s only working for single digits.

    If the class is list-10, it’s putting the data id as “0” for 11 “1” etc.

    I think it is because of this

    n = identifier.substr(identifier.length-1);

    I feel like I should be able to make it so that it takes the end of the identifier, minus the first five characters something along the lines of

    n = identifier.substr(identifier.length-5%);

    Do you have any idea what this kind of function is called, and can I do it in jQuery??

    I’ve updated my original pen http://codepen.io/ald603/pen/NGqQgM

    Thanks!

    #207967
    amanda_
    Participant

    That did do it! And that function looks incredibly useful. I will read and try and understand

Viewing 2 posts - 16 through 17 (of 17 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.