jQuery isNumeric() Method

Beginner
6 min read
Updated: Oct 2026
4 examples
Live preview

What Is isNumeric()?

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.

Remember
$.isNumeric(value)  → true | false

$.isNumeric("-10")     // true
$.isNumeric("3.1415")  // true
$.isNumeric("")        // false
$.isNumeric(Infinity)  // false
$.isNumeric("10px")    // false
NeedUse
Legacy jQuery check$.isNumeric(val)
Modern number checkNumber.isFinite(n)
Detect NaNNumber.isNaN(n)

How to Use isNumeric()

Pass any value; read the boolean; then parse or reject.

  1. Start with a value (number, form string, option, etc.).
  2. Call $.isNumeric(value) — true means finite numeric.
  3. If true, convert with Number(value) or parseFloat as needed.
  4. Still apply your own range rules (min/max) after the type check.
PieceRequired?Role
valueYesAny JavaScript value to test
Return—Boolean — finite number / numeric string?
Follow-upUsualParse + validate range for your app

Pseudocode

Pseudocode
function isNumeric(value):
    // jQuery 3.0+ idea (simplified)
    if type(value) is not "number" and not "string":
        return false
    if value is NaN or Infinity or -Infinity:
        return false
    // string must coerce to a finite number as a whole
    return value represents a finite number

// Typical form flow:
raw = $("#qty").val()
if $.isNumeric(raw):
    n = parseFloat(raw)
else:
    show error

Cheat Sheet

Keep these facts handy while checking numeric values with jQuery.

TopicDetail
SyntaxjQuery.isNumeric(value) / $.isNumeric(value)
SincejQuery 1.7 (behavior tightened in 3.0)
StatusDeprecated 3.3 · removed 4.0
True examples"-10", "0", 0xFF, "8e5", +10
False examples"", {}, NaN, true, Infinity
Modern replaceNumber.isFinite()
Type helper$.type(value)

Live Preview

Pick a sample value and see what $.isNumeric() returns.

Browser demo of $.isNumeric() — same idea as the examples below.

Result
$.isNumeric("-10")
→ true

/* finite numeric string */

jQuery Examples

Short, copy-ready snippets. Open DevTools Console, or use Try It Yourself for a live editor.

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.
  4. Unary plus. +10 is already a number → true.

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.
  4. Other types. null, true, and undefined return false (jQuery 3.0+).

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.
  4. Message. Return a short status string for the UI.

Example 4 — $.isNumeric() vs isNaN()

Empty string is the classic trap with isNaN.

jQuery
console.log(isNaN(""));           // false  ("" → 0)
console.log($.isNumeric(""));     // false  (stricter)

console.log(typeof NaN);          // "number"
console.log($.isNumeric(NaN));    // false

console.log(Number.isFinite(10)); // true  (modern number check)
Try It Yourself

How It Works

  1. Coercion trap. isNaN("") is false because "" becomes 0.
  2. Stricter utility. $.isNumeric("") correctly returns false.
  3. NaN type. typeof NaN is "number", but $.isNumeric(NaN) is false.
  4. Modern path. For real numbers, prefer Number.isFinite(10).

Edge Cases & Pitfalls

Check these before relying on $.isNumeric() in real projects.

deprecated

Gone in jQuery 4.0

Plan a migration now. Use Number.isFinite for numbers; keep a tiny helper if you still need string support.

css

"10px" is false

CSS lengths are not whole numeric strings. Strip units yourself before checking, or parse with a dedicated CSS parser.

empty

Do not trust isNaN("")

Empty string coerces to 0 under isNaN. Prefer $.isNumeric (legacy) or Number.isFinite patterns instead.

jQuery 3

Booleans are false since 3.0

Older jQuery treated some coerced values differently. In 3.0+, only number and numeric string types can pass.

Browser Support

jQuery.isNumeric() needs jQuery 1.7–3.x in the browser. It was deprecated in 3.3 and removed in jQuery 4.0. Native Number.isFinite() works in all modern browsers.

✓ Deprecated · jQuery 3.3

jQuery.isNumeric()

Available with jQuery 1.7–3.x in Chrome, Firefox, Safari, and Edge. Prefer Number.isFinite() for new code. Not present in jQuery 4.0.

Legacy jQuery 3.x only
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
$.isNumeric() jQuery 1.7–3.x

Bottom line: Use $.isNumeric(val) only in jQuery 3.x legacy apps. For new projects, use Number.isFinite() (and a string helper when form input must pass).

Performance Notes

ApproachCostBest for
$.isNumeric(v)O(1)Legacy jQuery validation
Number.isFinite(n)O(1)Actual numbers (modern)
isNaN(v)O(1)Avoid for empty-string checks

All of these checks are cheap. Clarity and correctness matter more than micro-benchmarks — especially around empty strings and Infinity.

Key Takeaways

  • Role: $.isNumeric(v) → finite number or numeric string?
  • Rejects: "", NaN, Infinity, booleans, "10px".
  • Status: deprecated in 3.3, removed in 4.0.
  • Modern: prefer Number.isFinite().

One line: $.isNumeric is a finite-number gate for legacy jQuery — learn it to read old code, migrate new code to Number.isFinite.

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()

Learn how jQuery detects plain object literals vs host objects.

isPlainObject tutorial →

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