Answers for "jquery add property to external stylesheet"

CSS
1

add style to stylesheet via jquery

var sheets = document.styleSheets;
$.each(sheets, (index) => {
	let url = sheets[index].href;
	if (url == "sheet url") {
       let thisSheet = sheets[index];
       //add css hover styling to stylesheet
       thisSheet.insertRule('selector {color: black !important;}');
     }
})
Posted by: Guest on April-27-2022
0

jquery add external css to head

$("<link/>", {
   rel: "stylesheet",
   type: "text/css",
   href: "/styles/yourcss.css"
}).appendTo("head");
Posted by: Guest on April-06-2020

Code answers related to "jquery add property to external stylesheet"

Browse Popular Code Answers by Language