JSFiddle - React, Tailwind, and code Playground
HTML
<div></div>
<div></div>
<div></div>
JavaScript
var Site = {
init : function( context ) {
context = context || 'body';
$(context).find( 'div' ).addStuff();
}
};
$.fn.addStuff = function() {
return this.each( function() {
$(this).css({width:'100px',height:'100px',margin:'10px','background-color' : '#00CC00'});
});
}
Site.init();
// later in the code....
div = $('<div />' )
$('body').append( div );
div.addStuff().css({
width: '200px'
});