JSFiddle - React, Tailwind, and code Playground

HTML

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/dot-luv/jquery-ui.css">
<div id="bob"></div>

JavaScript

(function($) { 
    function doSomething(id){
        doSomethingElse('test');
        doSomethingElse('test2');
    }
    function doSomethingElse(str){
        alert(str);
    }
    $.fn.myMethod = function() {
      return this.each(function(){
        doSomething(jQuery(this).attr("id"));
      });   
    };
})(jQuery);


$("div").myMethod();