var javascript = "alert('hello');";
eval(javascript);
This will load JavaScript from the line, but will be warned that it is extremely unsafe and not recommended. If a malicious process has ever interrupted your JavaScript string, this can lead to security problems.
As for CSS, you can add a style tag to the page using jQuery, for example:
$('head').append("<style>body { background-color: grey; }</style>");
Or, for JavaScript purists:
var s = document.createElement("style");
s.innerHTML = "body { background-color:white !important; }";
document.getElementsByTagName("head")[0].appendChild(s);
source
share