I am trying to get which event is occured ::
function getEvent(){
alert(window.event);
}
I am getting below event object. I want it in string to compare. if event onclick event then I want to do the action. how can I get it in string? or how can I convert event object to string?
[object MouseEvent]
Use the type property. window.event.type
You'd probably want:
function getEvent(){
alert(window.event.type);
}
https://developer.mozilla.org/en-US/docs/DOM/event.type
you can easily get it by type
like this
function getEvent(){
alert(window.event.type);
}
More info here
http://www.quirksmode.org/js/events_access.html
http://www.quirksmode.org/js/events_properties.html
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