Last Updated: February 25, 2016
·
1.666K
· xero

css style injection via jQuery

basically calling body/head append with a style tag and your own css will add a new tag and your styles to the bottom of the page/head and override any existing ones. why is this useful? imagine embedding a single js file into the page and defining your own styles (think widget for a client), or loading css via ajax, etc.

$('head').append('<style type="text/css">.myCSS{color:#00ff00}</style>');

here's an example gist :: http://git.io/V3q1MQ