javascript how to add css file code example
Example 1: javascript css link append
document.getElementsByTagName("head")[0].insertAdjacentHTML(
"beforeend",
"<link rel=\"stylesheet\" href=\"path/to/style.css\" />");
Example 2: append css file with javascript
var cssFile = document.createElement('link');
cssLink1.rel = 'stylesheet';
cssLink1.href = "styles.css"; // or path for file {themes('/styles/mobile.css')}
document.head.appendChild(cssFile); // append css to head element