JSFiddle - React, Tailwind, and code Playground
by lollero
HTML
<input id="myID" type="text" value="" placeholder="id" />
<input id="myText" type="text" value="" placeholder="text" />
<button id="button">clickety click</button>
<textarea id="textarea"></textarea>
CSS
#yay {
background: black;
color: white;
}
JavaScript
(function($) {
$.fn.extend({
test: function( options ) {
var defaults = {
};
return this.each(function() {
var obj = $(this ),
objD = obj.data(),
o = $.extend( {}, defaults, options, objD);
obj.on("click", function() {
$('#textarea')
.html( '<div id="'+ $("#myID").val() +'">'+ $('#myText').val() +'</div>' )
.select();
});
});
}
});
})(jQuery);
$('#one, #two, #three').test();