How to get Number from a text in Jquery -
i have got text quantity 2
in format .
how extract number above variable .
i tried way , displaing nan .
var lasth6= 'quantity 2'; var number = parseint(lasth6, 10); alert(number);
this jsfiddle
could please . how ??
you can remove non integer characters using:
.replace( /[^\d.]/g, '' )
and using .parseint()
:
parseint(lasth6.replace( /[^\d.]/g, '' ), 10)
Comments
Post a Comment