Changing the function scope
Prerequisites
You have to have a basic idea of Event handling in JavaScript , and specifically How to handle events in jQuery
Event Handling
When a handler is executed in JavaScript, the "this" value inside it is equal to the object it's being associated with. In some libraries such as Prototype.js, we have the option of using the bind() method to alter the function in such a way that the value of "this" is whatever we wish. See the prototype.js documentation on bind() . This way, we can customize the scope in which a function runs.
In jQuery, however, this option doesn't exist. The workaround is to pass parameters through the event object, using the "data" parameter of the event bind() function.