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");
}
See Question&Answers more detail:os