style on event 1

style on event

var linkElement = document.createElement("link");
linkElement.rel = "stylesheet";
linkElement.href = "path/to/file.css"; //Replace here
document.head.appendChild(linkElement);

Here is what the above code is Doing:
1. Create a new link element
2. Set the rel attribute to stylesheet
3. Set the href attribute to the path of the file
4. Append the link element to the head element

Similar Posts