I have a javascript file that load a content via AJAX and apply the appropriate style by loading the corresponding CSS file:
var ssioCss = document.createElement("link");
ssioCss.setAttribute("href", baseURL + "ssio-plugin.css");
ssioCss.setAttribute("type", "text/css");
document.head.appendChild(ssioCss);
But unfortunately, the style is not applied, event the file was correctly loaded (checked via chrome inspector).
Did I missed something? Any idea how to fix that?
Thanks in advance.
You’re missing something:
Otherwise there’s nothing to tell the browser what to do the with the downloaded file. Just in case you’re wondering,
type = "text/css"only restricts the MIME Type.