How to dynamically change the style tag using JavaScript?

前端 未结 9 2165
走了就别回头了
走了就别回头了 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:32

    Why don't you use the jQuery library and append new CSS to the DOM elements directly?

    For example:

    
    
    
    Test

    This would add a border around your element with the ID "an_element".

    jQuery Selectors

    jQuery CSS

提交回复
热议问题