I know I can get the event, by passing it as a parameter of the function:
$(".selector").on("click", function(event) {
});
How can I get it if it is not a parameter of the function?
For instance,
$(".selector").on("click", function() {
// var event = ???
});
Even if the parameter is not declared, it is still passed to the function, so you can write:
$(".selector").on("click", function() {
var evt = arguments[0];
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With