Hello,
I'm want to create a style element after loading of page ( say about 2-3 sec after page loaded )
html
<html>
<body>
<div id="div1" >
<div id= "div2" > some text goes here </div>
</div>
</body>
</html>
javascript
$(function() {
var style = $('<style type="text/css" />').appendTo('head');
style.html(
'body{ background:#000; }
\n
\#div1{ background:#0099f9; }'
//I'm having some more elements which I need to alter their style attr's
);
var attr = style.html;
style.html(
attr +
'\n
\#div2{ background:#f0f; }'
);
});
I'm also having a bunch of html elements ( some more elements other than mentioned ) in which I need to change their styles after the page loaded
I feel the difficulty when I try to read my code because it is hard coded,
I'm also facing the problem, when I need to add some elements to the above style tag
Is their simple way to do this & make it simple for readability
Thanks for help !!
Have a Good Day !