jQuery.noop (alias $.noop) is a shared empty function that does nothing when called (since jQuery 1.4). Official use: pass it around when an API wants a function but you have no work to do.
Remember
$.noop → function () {} (shared reference)
$.noop() → undefined (call does nothing)
// Plugin default pattern:
var onComplete = options.onComplete || $.noop;
onComplete(); // always safe to call
When a callback is optional, default it: var cb = options.cb || $.noop.
Call cb(...) without an if (cb) guard.
Pass $.noop (the reference) into APIs that require a function.
Remember: $.noop() returns undefined and ignores arguments.
Piece
Required?
Role
Arguments
None
Accepts any; all ignored
Call return
—
undefined
Reference
—
$.noop — shared empty function
Pseudocode
Pseudocode
noop = function ():
// intentionally empty
return undefined
// Official idea for plugins:
callback = userCallback or noop
callback(result) // never throws for "missing" callback
Reference
Cheat Sheet
Keep these facts handy for optional callbacks.
Topic
Detail
Access
jQuery.noop / $.noop
Since
jQuery 1.4
Call result
undefined
Shared?
Yes — one function object
vs function(){}
New object each time you write it
Best for
Default / optional callbacks
Try it
Live Preview
Inspect $.noop, call it, or compare it with a fresh empty function.
Browser demo of $.noop — same idea as the examples below.
Result
typeof $.noop → "function"
$.noop() → undefined
Code
jQuery Examples
Short, copy-ready snippets. Open DevTools Console, or use Try It Yourself for a live editor.
Example 1 — Call the Empty Function
Confirm type, return value, and that arguments are ignored.
Call freely. Init and destroy always invoke a function.
No errors. Omitting options still works.
Example 4 — Shared Reference vs New Functions
$.noop is always the same object; function(){} is not.
jQuery
var a = $.noop;
var b = $.noop;
var c = function () {};
var d = function () {};
console.log(a === b); // true — shared
console.log(c === d); // false — new each time
Pass reference..on("click", $.noop) registers the empty function.
isFunction.$.isFunction($.noop) is true.
Click. The handler runs and does nothing — no error.
Use case. Handy stub while wiring events or disabling a hook temporarily.
Edge Cases & Pitfalls
Check these before using $.noop as a default callback.
call
Do not pass $.noop() as the callback
$.noop() is undefined. Pass $.noop (no parentheses) when an API needs a function.
return
Always returns undefined
If a callback must return a value (for example false to cancel), noop is the wrong default — supply a function that returns what you need.
shared
One shared function object
Do not attach custom properties to $.noop expecting isolation — every caller sees the same function.
vs proxy
Need a bound this? Use $.proxy
noop only fills “no work.” For context binding, use $.proxy().
Compatibility
Browser Support
jQuery.noop needs jQuery loaded. It has been available since jQuery 1.4+ in all browsers your jQuery build supports.
✓ jQuery 1.4+ · Browsers
jQuery.noop()
Works in Chrome, Firefox, Safari, Edge, and other browsers with jQuery loaded. Use the shared empty function as a safe default callback.
100%Browser support
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
$.noopBrowsers
Bottom line: Pass $.noop for optional callbacks; calling it returns undefined and does nothing.
Analysis
Performance Notes
Approach
Cost
Best for
$.noop
O(1), shared
Default / optional callbacks
function () {}
New object each time
One-off anonymous handlers
if (fn) fn()
Branch each call
When you prefer explicit guards
Prefer $.noop for stable defaults. The win is clarity and fewer branches, not micro-optimizing empty calls.
Remember
Key Takeaways
Role:$.noop is a shared empty function.
Pass the ref: use $.noop, not $.noop(), as a callback.
Defaults:options.fn || $.noop then always call.
Call result: always undefined; args ignored.
One line:$.noop is jQuery’s shared empty function — the standard default when a callback is optional.
Frequently Asked Questions
jQuery.noop is a shared empty function — a function that does nothing when called. Added in jQuery 1.4. You typically pass the reference $.noop as a callback; calling $.noop() returns undefined.
Calling $.noop() returns undefined because the function body is empty. The useful part is the function reference itself — store $.noop and pass it where a callback is required.
Both run no code, but $.noop is the same function object every time. Writing function() {} creates a new function object on each expression. For default callbacks, $.noop is clearer and slightly cheaper.
Use it as the default when optional callbacks are omitted: var onComplete = options.onComplete || $.noop; Then call onComplete() safely without checking if (onComplete) every time.
Yes. $.noop is a real function, so $.isFunction($.noop) is true. That makes it safe anywhere a callback function is expected.
Yes. The empty function ignores all arguments — calling $.noop(1, 2, 3) still does nothing and returns undefined. APIs that pass event objects or data to callbacks work fine with noop.