I am using javascript, i want to get the last digit of a string. The following is my code,
var idval = focused.id;
var lastChar1 = idval.substr(idval.length - 1);
Suppose myid name is idval5 means, it correctly returns 5
But if id name is idval21 means, it is returning 1 only. But i want 21 as a output.
Please anyone help