JSFiddle - React, Tailwind, and code Playground

HTML

<div id="some">
    
</div>

JavaScript

(function($){
  $.fn.MyPlugin = function(){

    return this.each(function(){
       var somefunction = function(arg1, arg2){ alert(arg1); },
           someotherfunction = function(arg1, arg2){ alert(arg2); },
           reallyimportantfunction = function(arg1, arg2){
            var foo = $(this).attr('id') + 'function';

            // here I want to call the function with the foo value as name, and pass it arg1 and arg2

            $()[foo](arg1, arg2); // <- doesn't work
               
           };

       reallyimportantfunction();
    });
  };  
})(jQuery);
    
    
jQuery(function($){
$('#some').MyPlugin ();

});