JSFiddle - React, Tailwind, and code Playground
HTML
<div id="test">
Will be replaced
</div>
JavaScript
(function (window, undefined) {
$.fn['printElement']= function(options) {
};
$.fn['printElement']['defaults']= {
greeting1: 'Hello ',
greeting2: 'World'
};
$.fn['printElement']['testFunc']= function(target, options){
var opt = $.extend({}, $.fn["printElement"]["defaults"], options);
$(target).html(opt.greeting1+opt.greeting2);
};
})(window);
$().ready(function() {
$().printElement.testFunc('#test',
{
'greeting2': 'plugin'
});
});