jQuery.isNumeric()
**DEPRECATED in Version 3.3**
JQ Home <<
Utilities <<
jQuery.isNumeric()
Numeric value detection.
Description
The jQuery.isNumeric()
jQuery Type utility method, returns a boolean dependant upon the specified value being numeric.
Shorthand version $.isNumeric()
- Returns
true
for numeric values.
This method was deprecated in jQuery 3.3.
Syntax
Signature | Description |
---|---|
jQuery.isNumeric( value ) | Return a boolean dependant upon the specified value being numeric. |
Parameters
Parameter | Description | Type |
---|---|---|
value | The value to test to see if it is numeric. | PlainObject |
Return
A Boolean
object.
jQuery.isNumeric( value )
Example
Utilities << Top
Return a boolean dependant upon the specified value being numeric.
In the example below when we press the button we test some values to see if they are numeric.
$(function(){
$('#btn3').one('click', function(){
$('#div3').append('Is null
numeric? ' + $.isNumeric(null) + '<br>');
$('#div3').append('Is undefined
numeric? ' + $.isNumeric(undefined) + '<br>');
$('#div3').append('Is "a" numeric? ' + $.isNumeric("a") + '<br>');
$('#div3').append('Is "-1" numeric? ' + $.isNumeric("-1") + '<br>');
$('#div3').append('Is -1 numeric? ' + $.isNumeric(-1) + '<br>');
$('#div3').append('Is +1 numeric? ' + $.isNumeric(-1) + '<br>');
$('#div3').append('Is 1.23 numeric? ' + $.isNumeric(1.23) + '<br>');
$('#div3').append('Is "1.6456456456e+1?" ' + $.isNumeric("1.6456456456e+1") + '<br>');
$('#div3').append('Is "0x00" numeric? ' + $.isNumeric("0x00") + '<br>');
$('#div3').append('Is false numeric? ' + $.isNumeric(false) + '<br>');
$('#div3').append('Is true numeric? ' + $.isNumeric(true) + '<br>');
$('#div3').append('Is NaN
numeric? ' + $.isNumeric(NaN) + '<br>');
$('#div3').append('Is Infinity
numeric? ' + $.isNumeric(Infinity) + '<br>');
});
});
div3. Some initial text.
Related Tutorials
jQuery Intermediate Tutorials - Lesson 10 - jQuery Copy, Data & Type Utilities