1 Answers
var cssId = 'myCss'; //search by Id if exist 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 = 'url to css file'; //put exact url here link.media = 'all'; head.appendChild(link); }
Credit: https://stackoverflow.com/questions/574944/how-to-load-up-css-files-using-javascript/46439433