javascript - How to fetch the last digit in the id of a textfield using jQuery -
i have retrieve id of textfield , find last number in id. did -
var div_id = parseint($(row).find('input:text').first().attr('id').length-1); but, fetches me number of letters in id . id's in form,
ivrgroupzbase_grpzwelcomenotes ivrgroupzbase_grpzwelcomenotes1 ivrgroupzbase_grpzwelcomenotes2 ivrgroupzbase_grpzwelcomenotes3 how can this
better solution in comment, matches numbers @ end no matter how many:
parseint(("ivrgroupzbase_grpzwelcomenotes".match(/[0-9]+$/) || [0])[0]) 0 parseint(("ivrgroupzbase_grpzwelcomenotes123".match(/[0-9]+$/) || [0])[0]) 123
Comments
Post a Comment