I’m attempting to append CSS styling to the head of a HTML page like so…
var HEAD = document.getElementsByTagName("head")[0];
s = document.createElement('Style');
s.id = 'cssp';
s.type = 'text/css';
s.innerHTML = ecks.cssp;
HEAD.appendChild(s);
However the CSS located in ecks.cssp never appears in the HTML page. What am I doing wrong?
Just an fyi, I’m using chrome to test.
There are ways to add a style element, but they are browser dependent, unlike adding a link.
The string must be valid css.