how to check number in jquery

sam
sam
Member
378 Points
48 Posts

Hi,

how to check number in jquery?

Views: 8962
Total Answered: 1
Total Marked As Answer: 1
Posted On: 03-Jul-2015 05:05

Share:   fb twitter linkedin
Answers
Rahul Maurya
Rahul M...
Teacher
4822 Points
23 Posts
         

Hi sam,

Use jQuery.isNumeric( value ) as:

var str = "Hello world!";
 
var res = $(str).substr(1, 4);
$.isNumeric("-10"); // true
$.isNumeric(16);// true
$.isNumeric(0xFF);// true
$.isNumeric("0xFF"); // true
$.isNumeric("8e5"); // true (exponential notation string)
$.isNumeric(3.1415);// true
$.isNumeric(+10);// true
$.isNumeric(0144);// true (octal integer literal)
$.isNumeric(""); // false
$.isNumeric({});// false (empty object)
$.isNumeric(NaN);// false
$.isNumeric(null); // false
$.isNumeric(true); // false
$.isNumeric(Infinity);// false
$.isNumeric(undefined);// false
Posted On: 03-Jul-2015 22:27
 Log In to Chat