Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieving the mousemove handler in jQuery

Is there any way to retrieve the current mouse move handler for a selection in jQuery?

The normal method, as per standard jQuery, would be to simply call $('selector').mousemove(), but I see that for the events this simulates the event instead of returning the handler.

Is this possible?

like image 219
Evan Knowles Avatar asked Nov 27 '25 09:11

Evan Knowles


1 Answers

I think what you are after are the mousemove handlers attached to an element, in that case you can use a non-documented method jQuery._data() like

var handlers = $._data($('div')[0], 'events').mousemove;

here handlers will be an array of objects where each object refer to a handler for mousemove event. from the object you can get the handler method using the handler property.

Demo: Fiddle

like image 133
Arun P Johny Avatar answered Nov 29 '25 21:11

Arun P Johny