2

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
}
vascop
  • 4,972
  • 4
  • 37
  • 50

1 Answers1

1

Event is passed to the event handling function as an argument by default

function myHandler(evt) {
    // You can use event object here
}
Sushanth --
  • 55,259
  • 9
  • 66
  • 105