Thursday, November 17, 2011

jQuery .isNumeric() function


jQuery .isNumeric() is new in jQuery 1.7. The $.isNumeric() method checks whether its argument represents a numeric value. If so, it returns true. and if input is not numeric then returns false. It is also useful as it also validate for decimal hex numbers and exponential strings.
$.isNumeric(16); // true
$.isNumeric(+10); // true
$.isNumeric(3.1415); // true
$.isNumeric(“8e5″); // true
$.isNumeric(NaN); // false

No comments: