Reputation: 5212
I have an event handler for the click event. The event handler is a named function instead of an anonymous function. How can I pass the event object to this named function?
// usual example
$(".sel").click(function(ev) {
// do stuff which involves the event
});
// my case
$(".sel").click(myHandler);
function myHandler() {
// hopefully do stuff which involves the event
}
Upvotes: 2
Views: 793
Reputation: 55740
Event is passed to the event handling function as an argument by default
function myHandler(evt) {
// You can use event object here
}
Upvotes: 1