jQuery.isNumeric()


jQuery.isNumeric( value )Returns: Boolean

Description: Determines whether its argument represents a JavaScript number.

The $.isNumeric() method checks whether a value is a finite number, or would be cast to one by Number. If so, it returns true. Otherwise it returns false. The argument can be of any type.

Example:

Sample return values of $.isNumeric with various inputs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// true (numeric)
$.isNumeric( "-10" )
$.isNumeric( "0" )
$.isNumeric( 0xFF )
$.isNumeric( "0xFF" )
$.isNumeric( "8e5" )
$.isNumeric( "3.1415" )
$.isNumeric( +10 )
$.isNumeric( 0144 )
// false (non-numeric)
$.isNumeric( "-0x42" )
$.isNumeric( "7.2acdgs" )
$.isNumeric( "" )
$.isNumeric( {} )
$.isNumeric( NaN )
$.isNumeric( null )
$.isNumeric( true )
$.isNumeric( Infinity )
$.isNumeric( undefined )