JSFiddle - React, Tailwind, and code Playground

by BenjaminRay

HTML

<div class="test">test</div>

JavaScript

var a = {
  addEvent: function(){
     $('.test').on('click.a', function(){
       //does something here.
         alert('event a');
     });
  }
}

var b = {
  addEvent: function(){
     $('.test').on('click.b', function(){
       //does something here.
         alert('event b');
     });
   }
}

a.addEvent();
b.addEvent();

$('.test').off('click.a'); //removes the a event listener