Do I have to write my own IsNumeric function?
Posted
by cf_PhillipSenn
on Stack Overflow
See other posts from Stack Overflow
or by cf_PhillipSenn
Published on 2010-04-05T18:17:27Z
Indexed on
2010/04/05
18:23 UTC
Read the original article
Hit count: 81
JavaScript
I found this function:
function IsNumeric(sText) {
var ValidChars = "0123456789.";
var IsNumber=true;
var Char;
for (i = 0; i < sText.length && IsNumber == true; i++) {
Char = sText.charAt(i);
if (ValidChars.indexOf(Char) == -1){
IsNumber = false;
}
}
return IsNumber;
};
Q: Isn't there a built-in JavaScript function for isNumeric? Something like val()?
© Stack Overflow or respective owner