jQuery.proxy() (alias $.proxy) returns a new function that always runs with a chosen this value (added in jQuery 1.4). It is mainly used so object methods keep the right this when used as event handlers.
Remember
$.proxy(fn, context) → bound function
$.proxy(context, "methodName") → bound method by name
// Without proxy: this → DOM element
// With proxy: this → your object
// Modern equivalent:
fn.bind(context)
Modern..bind(widget) is the recommended replacement.
Migrate. Swap $.proxy(fn, ctx) for fn.bind(ctx) in new code.
Edge Cases & Pitfalls
Check these before wiring proxied handlers in real apps.
deprecated
Prefer bind() for new code
jQuery marked $.proxy deprecated in 3.3. Use Function.prototype.bind or arrows unless you are maintaining older jQuery code.
unbind
Proxied handlers share event identity
Unbinding one proxied wrapper can remove others built from the same original function. Prefer namespaced events like click.myProxy1.
null context
Null/undefined context keeps call-site this
Since jQuery 1.9, that mode is useful for partial application of arguments without forcing a new this.
DOM this
Need the element? Use event.target
After proxying, this is your object. Read the clicked node from the event argument instead.
Compatibility
Browser Support
jQuery.proxy() is available since jQuery 1.4 and was deprecated in jQuery 3.3. Prefer native Function.prototype.bind() in all modern browsers. This page focuses on browser use with jQuery loaded.
✓ Deprecated · jQuery 3.3
jQuery.proxy()
Works in Chrome, Firefox, Safari, and Edge with jQuery 1.4+. Prefer Function.prototype.bind() for new code.
LegacyPrefer bind()
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
$.proxy()Legacy
Bottom line: Learn $.proxy() for legacy jQuery handlers. Write fn.bind(ctx) in new projects.
Analysis
Performance Notes
Approach
Cost
Best for
fn.bind(ctx)
One wrapper
All new code
$.proxy(fn, ctx)
One wrapper
Legacy jQuery handlers
Create proxy inside a hot loop
Wasteful
Avoid — create once, reuse the handler
Binding cost is tiny compared with DOM work. Create the proxied (or bound) function once and attach that same reference to events.
Remember
Key Takeaways
Role:$.proxy locks this for callbacks and handlers.
Modern: prefer fn.bind(ctx).
Unbind: use event namespaces, not only the function reference.
Status: deprecated in jQuery 3.3.
One line: know $.proxy for legacy handlers, but bind with fn.bind(ctx) (and namespaced .off()) in new code.
Frequently Asked Questions
jQuery.proxy() takes a function and returns a new function that always runs with a fixed this context. It is most useful for attaching object methods as event handlers so this inside the handler refers to your object, not the DOM element that fired the event.
jQuery.proxy(function, context) wraps a function with a chosen this value. jQuery.proxy(context, "methodName") looks up a method on an object by name and returns a bound version. Since jQuery 1.6 you can also pass extra arguments that are prepended to each call.
Both fix this and can pre-fill arguments. Native bind() is the modern standard. jQuery.proxy() was deprecated in 3.3; it also participates in jQuery's event tracking so .off() can match the original function in some cases — still prefer unique event namespaces when unbinding.
When you pass obj.handleClick directly to .on("click", obj.handleClick), JavaScript sets this to the clicked element. $.proxy(obj.handleClick, obj) returns a wrapper where this is always obj.
Not for new code. Prefer fn.bind(context) or arrow functions. Keep $.proxy only while maintaining legacy jQuery code that already uses it.
jQuery's event system can treat proxied wrappers as one identity. Binding $.proxy(fn, ctxA) and $.proxy(fn, ctxB), then calling .off with either proxy, may remove both. Use namespaced events like click.myHandler1 for safe unbind.
As of jQuery 1.9, a null or undefined context means the proxied function keeps the this value from the call site. That lets you partially apply arguments without forcing a new this.