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
If someone need to preserve dots in extracted numbers:
var some = '65,87 EUR'; var number = some.replace(",",".").replace(/[^0-9&.]/g,''); console.log(number); // returns 65.87