I’m validating my form, just checking if in the fields where a number should be the user has entered an string. But as I’m getting all the field values like this:
var number= $("#number").val();
All my variables are strings.
alert(typeof number);
shows “string” with all numeric fields values.
Any ideas on how can I validate integers??
Thanks a lot
You can use
method for this purpose. As a result you don’t need any extra parsing effort.
DEMO
Read more about
$.isNumeric()For manual parse(if you don’t use above)
and for check