Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
196
rated 0 times [  200] [ 4]  / answers: 1 / hits: 44956  / 12 Years ago, tue, november 13, 2012, 12:00:00

I want to change the style tag after generating contents.
How can I add style to the style tag?
I tried using:



document.getElementById('style').appendChild(styleContents);


but it did not work


More From » css

 Answers
12

You are probably trying to add css to the style tag. This can be accomplished using:



document.getElementsByTagName('style')[0].innerHTML=; //some css goes here


You can also use:



document.styleSheets[0].cssText = ; //some css goes here

[#82027] Sunday, November 11, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jesse

Total Points: 513
Total Questions: 118
Total Answers: 106

Location: Denmark
Member since Tue, Jul 19, 2022
2 Years ago
;