JSFiddle - React, Tailwind, and code Playground

by borayeris

HTML

<div id="me">hello</div>

JavaScript

$.fn.bindFirst = function(name, fn) {
    // bind as you normally would
    // don't want to miss out on any jQuery magic
    //alert( $(this).html() );
    this.bind(name, fn);
    var handlers = this.data('events')[name];
    // take out the handler we just inserted from the end
    var handler = handlers.splice(0)[0];
    // move it at the beginning
    handlers.splice(handlers.length, 0, handler);
};

$(function() {
    $("#me").clickfunction() { alert("1");alert( this.data('events')['click'] ) });
    $("#me").click(function() { alert("2"); });    
    $("#me").click(function() { alert("3"); });
});