ops typo error the plugin is like this (function($){ $.fn.btnInit = function() { function prepare(obj, caption, action) { obj .html(caption) .addClass("fg-button ui-state-default ui-corner-all") .click(function(){ // run the action here when click triggered alert('Do some action');}); };
return this.each(function(){ obj = $(this); prepare(obj, caption, action); }); }; })(jQuery);