I am using this function to remove anything other than numbers, but it is giving me error, value.replace in not a f开发者_StackOverflow中文版unction, Here's the function :
function filter_value(value)
{
var filter = value.replace(/[^0-9.]+/g,'');
return filter;
}
If replace
is not a function then value
is not a string. Make sure you pass a string to the function.
function filter_value(value) {
return parseInt(value.toString().replace(/\D+/g,''), 10);
}
This will return integer value
精彩评论