My text:
var str = 'Cost USD 400.00';
How do i use jquery to find number only in that str?
You probably shouldn't use JQuery for that; you should use built-in Javascript regular expression support. In this case your regular expression might look like:
var result = /\d+(?:\.\d+)?/.exec(mystring);
The official reference for this is at https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/RegExp .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With