Shanmuga Kumar Shanmuga Kumar - 4 months ago 7
Javascript Question

How to remove the character form string using jQuery?

How to remove character from strings (a-z, A to Z) using jQuery or JavaScript?

if str=avc234jw6;


I need only 2346.

Answer

A simple String.replace with regex /[a-z]/ig can do!

var str = "avc234jw6";
var no = parseInt(str.replace(/[a-z]/ig, ""));

console.log(no);

Comments