jQuery isFunction() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Utilities

Definition

jQuery.isFunction(value) (alias $.isFunction) returns true when value is callable as a function (since jQuery 1.2). Use it to guard optional callbacks before calling them.

Syntax

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

jQuery
$.isFunction(value)  → true | false

$.isFunction(function () {})  // true
$.isFunction("text")          // false
$.isFunction($)               // true  (jQuery factory)
$.isFunction($("div"))        // false (collection)

// Prefer in new code:
typeof x === "function"
CallWhat it does
isFunction()Learn jQuery.isFunction(): test if a value is callable, guard callbacks before calling, migrate to typeof x === \

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

Parameters

ParameterDescription
Step 1Have a value that might be a callback (plugin option, handler, done).
Step 2Call $.isFunction(value) (legacy) or typeof value === "function" (preferred).
Step 3If true, invoke it safely.

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 Function Test

A function is true; a string is false.

jQuery
console.log($.isFunction(function () {}));  // true
console.log($.isFunction("text"));          // false
Try It Yourself

How It Works

  1. Function literal. function () {} is callable → true.
  2. String. "text" is not a function → false.
  3. Boolean result. Easy to use in if before invoking.

Example 2 — Guard an Optional Callback

Call done only when it is a function.

jQuery
function finish(result, done) {
  if ($.isFunction(done)) {
    done(result);
  }
}

finish("ok", function (msg) {
  console.log(msg);  // "ok"
});
finish("ok", null);  // no call, no error
Try It Yourself

How It Works

  1. Optional arg. done may be a function or missing.
  2. Guard. $.isFunction(done) prevents calling null.
  3. Invoke. When true, run done(result).

Example 3 — Prefer typeof x === "function"

Same answers — the recommended replacement.

jQuery
var fn = function () {};
var text = "nope";

console.log($.isFunction(fn));             // true
console.log(typeof fn === "function");     // true

console.log($.isFunction(text));           // false
console.log(typeof text === "function");   // false
Try It Yourself

How It Works

  1. Same results. Both APIs agree on functions and non-functions.
  2. No jQuery needed. typeof is built into JavaScript.
  3. Docs guidance. jQuery 3.3+ recommends this replacement.

Frequently Asked Questions

jQuery.isFunction(value) returns true when value is callable as a function, and false otherwise. The official example is $.isFunction(function () {}) → true.
Yes. It was deprecated in jQuery 3.3 and removed in jQuery 4.0. Prefer typeof x === "function" in all new code.
For normal functions they agree. The jQuery docs recommend replacing most $.isFunction(x) checks with typeof x === "function".
Yes. Arrow functions, async functions, generators, and classic function declarations/expressions are all functions — they return true.
No. $("div") is an object collection → false. The jQuery factory $ itself is a function → true.
jQuery.type(value) returns the string "function" for functions. jQuery.isFunction(value) returns true for those same values. Prefer a boolean check before calling a callback.
Yes, if an older jQuery that still includes isFunction is loaded. Prefer typeof x === "function" everywhere — it is native and does not need jQuery.

Next: isNumeric() Method

Test finite numbers and numeric strings with jQuery.

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

8 people found this page helpful