67
rated 0 times
[
74]
[
7]
/ answers: 1 / hits: 31944
/ 9 Years ago, tue, may 19, 2015, 12:00:00
How to check if a textbox contains numbers only?
While googling I came across this. But I'm wondering if isNumeric
can be used for this purpose or if there are more simpler ways of checking if a textbox has a numeric value.
var query = $('#myText').val();
if (parseFloat(query) == NaN) {
alert(query is a string);
} else {
alert(query is numeric);
}
More From » jquery