jQuery isNumeric() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Utilities

Definition

jQuery.isNumeric(value) (alias $.isNumeric) returns true when value represents a finite JavaScript number (added in jQuery 1.7). As of jQuery 3.0, that means type number or a string that coerces to a finite number.

Syntax

Start with these common calls. Keep them short and readable.

jQuery
$.isNumeric(value)  → true | false

$.isNumeric("-10")     // true
$.isNumeric("3.1415")  // true
$.isNumeric("")        // false
$.isNumeric(Infinity)  // false
$.isNumeric("10px")    // false
CallWhat it does
isNumeric()Learn jQuery.isNumeric(): test finite numbers and numeric strings, reject NaN Infinity and CSS units, official true/false samples, examples, pitfalls, and FAQs.

Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.

Parameters

ParameterDescription
Step 1Start with a value (number, form string, option, etc.).
Step 2Call $.isNumeric(value) — true means finite numeric.
Step 3If true, convert with Number(value) or parseFloat as needed.

Return Value

Return ValueDescription
BooleanOften true or false depending on the match or state.
Value / undefinedGetters usually return a value from the first matched element, or undefined when nothing applies.

jQuery Examples

Example 1 — Official True (Numeric) Values

Samples from the jQuery API that return true.

jQuery
console.log($.isNumeric("-10"));     // true
console.log($.isNumeric("0"));       // true
console.log($.isNumeric(0xFF));      // true
console.log($.isNumeric("0xFF"));    // true
console.log($.isNumeric("8e5"));     // true
console.log($.isNumeric("3.1415"));  // true
console.log($.isNumeric(+10));       // true
Try It Yourself

How It Works

  1. Signed string. "-10" is a whole numeric string → true.
  2. Zero and hex. "0", 0xFF, and "0xFF" all represent finite numbers.
  3. Sci / decimal. "8e5" and "3.1415" coerce to finite numbers.

Example 2 — Official False (Non-Numeric) Values

Values the official docs mark as non-numeric.

jQuery
console.log($.isNumeric("-0x42"));     // false
console.log($.isNumeric("7.2acdgs"));  // false
console.log($.isNumeric(""));          // false
console.log($.isNumeric({}));          // false
console.log($.isNumeric(NaN));         // false
console.log($.isNumeric(null));        // false
console.log($.isNumeric(true));        // false
console.log($.isNumeric(Infinity));    // false
console.log($.isNumeric(undefined));   // false
Try It Yourself

How It Works

  1. Partial strings. "-0x42" and "7.2acdgs" are not clean numeric strings.
  2. Empty / object. "" and {} are not numbers.
  3. Special numbers. NaN and Infinity fail the finite check.

Example 3 — Validate a Quantity Input

Confirm the field is numeric before accepting a value.

jQuery
function checkQty(raw) {
  if (!$.isNumeric(raw)) return "Enter a valid number";
  var n = parseFloat(raw);
  if (n < 1) return "Minimum quantity is 1";
  return "OK: " + n;
}

console.log(checkQty("5"));     // "OK: 5"
console.log(checkQty("abc"));   // "Enter a valid number"
console.log(checkQty("0"));     // "Minimum quantity is 1"
Try It Yourself

How It Works

  1. Gate. $.isNumeric(raw) rejects junk like "abc" first.
  2. Parse. On success, parseFloat turns the string into a number.
  3. Range. Business rule: quantity must be at least 1.

Frequently Asked Questions

jQuery.isNumeric(value) returns true when value is a finite number, or a string that can be coerced into a finite number (such as "10", "-3.5", or "8e5"). It returns false for empty strings, booleans, objects, NaN, Infinity, null, undefined, and partial strings like "10px".
Yes. It was deprecated in jQuery 3.3 and removed in jQuery 4.0. It still works in jQuery 3.x for legacy code. Prefer Number.isFinite() for real numbers, or a small helper when you must accept numeric strings from form inputs.
Yes — as of jQuery 3.0 it accepts type number or type string when the string coerces to a finite number. "42", "-10", "3.1415", "0xFF", and "8e5" all return true. "10px" and "7.2acdgs" return false.
isNaN coerces values and can surprise you — isNaN("") is false because "" becomes 0. $.isNumeric("") is false. Use $.isNumeric (or Number.isFinite) when you want a stricter finite-number check.
Only finite numeric values pass. Infinity and NaN have typeof "number" in JavaScript, but they are not useful as ordinary numeric input — jQuery excludes them on purpose.
For actual numbers, use Number.isFinite(value). For form strings, trim first, then check with Number.isFinite(Number(str)) or parseFloat plus a finite check — and still validate ranges for your app.

Next: isPlainObject() Method

Learn how jQuery detects plain object literals vs host objects.

isPlainObject() Method tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

9 people found this page helpful