JSFiddle - React, Tailwind, and code Playground

by Osman Salihovic

HTML

<script src="https://code.jquery.com/jquery-2.2.3.js"></script>
<div id="id1">DIV 1</div>
<div id="id2">DIV 2</div>

JavaScript

(function(defaults, $, window, document, undefined) {
  'use strict';
  $.extend({
    // Function to change the default properties of the plugin
    // Usage:
    // jQuery.pluginSetup({property:'Custom value'});
    pluginSetup: function(options) {

      return $.extend(defaults, options);
    }
  }).fn.extend({
    // Usage:
    // jQuery(selector).pluginName({property:'value'});
    pluginName: function(options) {

      options = $.extend({}, defaults, options);

      return $(this).each(function() {

        // Plugin logic
        // Calling the function:
        // jQuery(selector).pluginName(options);
      });
    },
    otherMethod: function() {
		console.log('otherMethod');
      // Some logic
      // Calling the function:
      // jQuery(selector).otherMethod(options);
    }
  });
})({
  property: "value",
  otherProperty: "value"
}, jQuery, window, document);


(function($) {
	$.fn.otherMethod=function ()
	{
		alert('aa');
	}
	
	$('#div').otherMethod({property:'value'});
	
}) (jQuery);