How can i check which event called my function on Javascript with Jquery?
Like i have:
var mycall= function() {
alert('Which Witch is Which?');
}
$(window).load(mycall);
$(window).resize(mycall);
I understand that i could pass a parameter to the function, still i'm interested in a way to do this without passing any parameters.
Use the type
property in the event
object:
var mycall = function(e) {
alert(e.type);
};
Add an event to the function args and then event.type
will give tell which event is triggered. See below,
var mycall= function(e) {
alert(e.type);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.