For default
$().mouseout(function(){…})
The mouseout
event is on in the page
Can I use any way to detect the event is whether on?
I want the detect method return a Boolean for me to use.
Hope to see your answer.
$._data
, yea!Yes, you can do so by checking this way:
console.log($._data( $(element)[0], "events" ));
$("#foo").on({
click: function(){ alert("Hello") },
mouseout: function(){ alert("World") }
});
$._data( $("#foo")[0], "events" );
So, you can use the returning object and perform operations.
myEvents = $._data( $("#foo")[0], "events" );
// Check if the mouse event is set
if (myEvents.mouseout.length > 1)
// Do something