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 Reply To: How to get js(jQuery) to generate dynamic code

#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!