JSFiddle - React, Tailwind, and code Playground
CSS
div { width: 200px; height: 200px; background-color: red; }
JavaScript
$.fn.lastHandler = function(events,handler) {
var element = $(this);
events = events.split(' ');
for (var evt in events) {
var event = $(element).data("events")[events[evt]];
var hsucess = null;
$.each(event, function (i, h) {
if (h.handler == handler) {
hsucess = h;
}
});
var index = event.indexOf(hsucess);
if (index > -1) {
event.splice(index, 1);
event.push(hsucess);
}
}
};
$(function() {
var m1 = function(){ alert("mouseover to be the last"); };
var m2 = function(){ alert("mouseover to be the first"); };
var m3 = function(){ alert("mouseover to be the second"); };
$("#el").mouseover(m1);
$("#el").mouseover(m2);
$("#el").mouseover(m3);
$("#el").lastHandler('mouseover',m1);
});