+ 1
How to load CSS stylesheet using JavaScript?
Is there a simpler and shorter way to load CSS stylesheet in html using javascript only? I'm planning to make a changeable webpage theme using two different CSS file and I'm going to use JS to load any of the two CSS file.
1 ответ
+ 2
You could asign an ID to the link element of the CSS file, and then change the href's value via document.getElementById("link-element").setAttribute("href","path-to-css-file");