lets assume that I have the following …
jQuery('#a').click(function(){
myFunction();
});
function myFunction(){
var me = jQuery(this);// this one gets the "window" object instead of "#a" element
}
How can I get the target element that initiated the event from myFuncton while I cant send this as parameter because its going to coast me to go back and re-check the whole site and change every function call arguments …
So you could just do:
Update:
If you need to do other thing in the callback other then myFunction, then you could try
.call()or.apply()to execute a function with a given this value.