How to dynamically change the style tag using JavaScript?

前端 未结 9 2145
走了就别回头了
走了就别回头了 2021-01-01 21:50

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\').appendChil         


        
9条回答
  •  旧巷少年郎
    2021-01-01 22:23

    A style element has no element children, as its content is by definition just text (as far as HTML is concerned). But this means that you can just append to its content using the innerHTML property. If your element has