I have a string in JavaScript like #box2 and I just want the 2 from it.
#box2
2
I tried:
var thestring = $(this).attr(\'href\'); var
Using match function.
var thenum = thestring.match(/\d+$/)[0]; alert(thenum);
jsfiddle