Vignesh Pichamani Vignesh Pichamani - 1 year ago 98
Javascript Question

Internal CSS using jquery

Good Day!!!

I am trying to add the

css using jquery
. when i viewing the code using firebug. It looks like in inline css format. But i want to load the internal css property using jquery.
Is it possible to add the internal css using jquery.


It appear like For example

<p style="color:#fff"></p>

I want to load as with

<style type="text/css">
p {

Not sure, how to do it any one review and advise.


enter image description here

Answer Source

Yes you can, just append a style tag to the head:

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

see example here jsfiddle