//http://www.jermywells.com $.fn.greenify = function() { this .css( "background-color", "green" ) .css('color', 'white'); return this; } $(document).ready(function(){ $('#myGreenifiedDiv').greenify(); });
<div id="myGreenifiedDiv">greenified</div>
#myGreenifiedDiv{ width:150px; height:150px; text-align:center; }