69
rated 0 times
[
70]
[
1]
/ answers: 1 / hits: 27899
/ 13 Years ago, fri, june 24, 2011, 12:00:00
Possible Duplicate:
Is there a (built-in) way in JavaScript to check if a string is a valid number?
i want to check whether a textbox contains a numeric value or a string using javascript
i used this.
var query=getquerystring()
if(isNaN(query))
{
alert(query is a string);
}
else{
alert(query is numeric);
}
where getquerystring() is a function as
function getquerystring() {
var query=document.getElementById(queryString).value;
return query;
}
but when i enter a number 1234 in textbox still getting query is a string.
please tell me what is wrong in my code, and suggest me some solution.
More From » javascript