I have a string in JavaScript like #box2
and I just want the 2
from it.
I tried:
var thestring = $(this).attr(\'href\');
var
Tried all the combinations cited above with this Code and got it working, was the only one that worked on that string -> (12) 3456-7890
var str="(12) 3456-7890";
str.replace( /\D+/g, '');
Result: "1234567890"
Obs: i know that a string like that will not be on the attr but whatever, the solution is better, because its more complete.