JSFiddle - React, Tailwind, and code Playground

by bouillard

HTML

<div id='a'>a</div>
<div id='b'>b</div>

CSS

.wa {
    background-color : red;
}

JavaScript

(function( $, undefined ) {
  $.widget( "my.wa", { 
    // Set up the widget
    _create: function() {
      console.log('create A');
      $(this.element).addClass('wa');
    },
    destroy: function() {
      $(this.element).removeClass('wa');
      $.Widget.prototype.destroy.call( this );
    }
  });

  $.widget( "my.wa1",$.my.ma, { 
    // Set up the widget
    _create: function() {
      console.log('create A1');
      $.ui.myWidget.prototype._create.apply(this, arguments);
    },
    destroy: function() {
      $.Widget.prototype.destroy.call( this );
    }
  });
})( jQuery );

$(function() {
    $('#a').wa1();
});