link stylesheet in javascript
document.getElementsByTagName("head")[0].insertAdjacentHTML(
"beforeend",
"<link rel=\"stylesheet\" href=\"path/to/style.css\" />");var cssId = 'myCss'; // you could encode the css path itself to generate id..
if (!document.getElementById(cssId))
{
var head = document.getElementsByTagName('head')[0];
var link = document.createElement('link');
link.id = cssId;
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'http://website.com/css/stylesheet.css';
link.media = 'all';
head.appendChild(link);
}
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
Also in JavaScript:
- inline math mathjax
- javascript delete element
- array con javascript
- defer parsing of javascript avada
- javascript regex
- how to make react native dapp truffle
- js remove json value duplicates
- document jquery
- js toFixed
- javascript date get day of week abbreviation
- remove square brackets from string javascript
- javascript increment
- how to create duplicate key array in javascript
- showing difference between dates in minutes js
- delete package-lock.json command
- react native vs flutter
- nuxtjs http multiple proxy
- react check if localhost
- cordova delete cache
- program to parenthesize an expression
- how to fill false into array javascript
- calling function from function object javascript
- flatten an array javascript
- google script define array