# Context for jQuery plugin event handlers.

**URL:** <https://community.transloadit.com/t/context-for-jquery-plugin-event-handlers/17816>\
**Category:** Transloadit\
**Tags:** tender-archive\
**Created:** [December 1, 2010, 6:17pm UTC](https://community.transloadit.com/t/context-for-jquery-plugin-event-handlers/17816 "2010-12-01T18:17:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dennis](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.transloadit.com/dennis/32/1480_2.png) [@dennis](https://community.transloadit.com/u/dennis)\
**Post date:** [December 1, 2010, 6:17pm UTC](https://community.transloadit.com/t/context-for-jquery-plugin-event-handlers/17816/1 "2010-12-01T18:17:00Z")

</div>

> Archived from the Transloadit support forum. Originally posted on December 1, 2010; details may be outdated, see [our docs](https://transloadit.com/docs/) for current behavior. [Original thread](https://web.archive.org/web/20101206230327/http://support.transloadit.com/discussions/suggestions/17-context-for-jquery-plugin-event-handlers)

I have a onCancel and onError function I want to share between several .transloadit() handlers. However, inside the shared functions, I don’t have a context of what form has triggered the function.

A simplified example:

```auto
var onErrorHandler = function() { 
    // what form triggered the error? 
};
$('form').transloadit({ ..., onError: onErrorHandler });

```

---

<div class="post-metadata">

**Author:** ![Felix\_Geisendorfer](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.transloadit.com/felix_geisendorfer/32/1463_2.png) [@Felix\_Geisendorfer](https://community.transloadit.com/u/Felix_Geisendorfer)\
**Post date:** [December 1, 2010, 6:41pm UTC](https://community.transloadit.com/t/context-for-jquery-plugin-event-handlers/17816/2 "2010-12-01T18:41:00Z")

</div>

I guess you could solve this problem by wrapping your callbacks in a closure that sets the context.

But let’s make this good, how would setting the ‘this’ context to the form element the callback is on for all callbacks? Would that work for you?

---

<div class="post-metadata">

**Author:** ![dennis](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.transloadit.com/dennis/32/1480_2.png) [@dennis](https://community.transloadit.com/u/dennis)\
**Post date:** [December 1, 2010, 7:44pm UTC](https://community.transloadit.com/t/context-for-jquery-plugin-event-handlers/17816/3 "2010-12-01T19:44:00Z")

</div>

That would be perfect.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex032/uploads/transloadit/original/1X/04ee57da0cb7ac8728a9ac5965c288164f4ce280.svg) [@system](https://community.transloadit.com/u/system)\
**Post date:** [October 7, 2026, 9:04am UTC](https://community.transloadit.com/t/context-for-jquery-plugin-event-handlers/17816/4 "2026-10-07T09:04:12Z")

</div>


