Tibco is removing JQuery from Spotfire and I have some Dashboards relying on Jquery to work, as shown bellow:
var css = "https://localhost/css/style.css";
if (!$('link[href="' + css +'"]').length) {
$("<link/>", { "rel": "stylesheet", "type": "text/css", "href": css }).appendTo("head");
}
I would like to do the same using Javascript, but I was unable to find a solution that allow me to load the CSS only if does not exist in DOM.
2
Answers
Whatever selector that works in jQuery will work with
document.querySelector
method.Something like this: