html - Why would you give a style tag an id -


Hello has seen some sites which give style tags an ID such as:

  & Lt; Style ID = Style-ID & gt; & Lt; / Style & gt;  

Can you first understand why you do this and what are the benefits of doing so?

Then you can refer to it (like any other element), i.e.

  var styles = document.getElementById ('style-id'); // want to do something like styles.parentNode.removeChild (styles); // Remove these styles styles .setAttribute ('href', 'altern-styles.css'); // Change style  

Comments