Home › Forums › JavaScript › How to get js(jQuery) to generate dynamic code › Reply To: How to get js(jQuery) to generate dynamic code
September 10, 2015 at 7:50 am
#207952
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!