How to remove alpha characters from string using jQuery

jQuery for remove alpha characters from string.

If your string is :

var myString = ‘<jainish> 143.8 Text’;

and you want numeric value, dot and dash in your string then you have to use following jQuery

var myString = myString.replace(/[^\d.-]/g, '');

And output will be :


If you want only numeric value then Following should do the trick.

var myString = myString.replace(/[^\d]/g, '');

And output will be :


If you have any queries, please do not hesitate to contact me at Jainish Senjaliya