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,464
  • 4
  • 35
  • 49

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 --
  • 54,565
  • 8
  • 62
  • 98