JSFiddle - React, Tailwind, and code Playground

by darcyclarke

JavaScript

$.fn.myPlugin = function(){
    
    var scopedVar = 'test';
       
    this.subMethod = function(){
        console.log(scopedVar);
    };
    
    return this.each(function(){
      // ...   
    });
};
          
var $obj = $('body').myPlugin();
$obj.subMethod();