jQuery CSS – Write into the -tag

While not changing an existing style element, this works as a cross-browser way to create a new one:

$( "<style>body { background: black; }</style>" ).appendTo( "head" )

By cascading, it’ll override existing styles, which should do the trick.

Leave a Comment