Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery .isNumeric

Tags:

I have a text box with an id of EmpNum. I cannot figure out how to use jQuery's isNumeric to check to see if the value is numeric or not.

I tried:

    ('#.EmpNum').IsNumeric  

but that did not work.

like image 727
Nate Pet Avatar asked Dec 01 '11 14:12

Nate Pet


People also ask

Is numeric check in jQuery?

The isNumeric() method in jQuery is used to determine whether the passed argument is a numeric value or not. The isNumeric() method returns a Boolean value. If the given argument is a numeric value, the method returns true; otherwise, it returns false. This method is helpful as it decreases the lines of code.

How do you check if it is not a number in jQuery?

The $. isNumeric() method checks whether its argument represents a numeric value. If so, it returns true . Otherwise it returns false .

How do you check if a field is number or not?

The ISNUMERIC() function tests whether an expression is numeric. This function returns 1 if the expression is numeric, otherwise it returns 0.


1 Answers

according to http://api.jquery.com/jQuery.isNumeric/

it's :jQuery.isNumeric(value)

so, it should be $.isNumeric($("#EmpNum").val())

like image 102
Ya Zhuang Avatar answered Oct 21 '22 15:10

Ya Zhuang