JSFiddle - React, Tailwind, and code Playground

by igalst

HTML

<button type="button" id="foo">click me</button>

JavaScript

$.event.special.click = {
    add: function( handler, data, namespaces ) {
        // called for each bound handler
      console.log("A");
    },

    setup: function( data, namespaces ) {
        // called once per an element
      console.log("B");
      //jQuery( this ).bind( "click", jQuery.event.special.click.handler );
      $.event.add( this, "click", jQuery.event.special.click.handler);
    },

    remove: function( namespaces ) {
        // called for each bound handler
      console.log("C");
    },

    teardown: function( namespaces ) {
        // called once per an element
      console.log("D");
      jQuery( this ).unbind( "click", jQuery.event.special.click.handler );
    },

    handler: function( event ) {
      console.log("HANDLER");
        // set correct event type
        event.type = "click";
        // trigger multiclick handlers
        jQuery.event.handle.apply( this, arguments );
    }
};

console.log($.event)

$("#foo").on("click", function(e){
  console.log(e);
  alert("superClicked!");
});