How to remove the selector via JS?

Like using JS to remove the selector *?
*{
 background: red;
color:red;
}
June 5th 19 at 21:02
3 answers
June 5th 19 at 21:04
Solution
Jquery:
$("*").css({"background":"","color":""});
June 5th 19 at 21:06
Solution
js
document.getElementsByTagName('body')[0].style.backgroundColor = ";
document.getElementsByTagName('body')[0].style.color = ";
June 5th 19 at 21:08
Solution
read about CSSOM. https://developer.mozilla.org/en-US/docs/Web/API/C...

if you know it's the stylesheet and the rule in it (judging by the selector, if you have any worries reset, which is always first), then it's simple:
document.styleSheets[0].deleteRule(0);

if you do not know, will have to sort through and look for:
let i = [...document.styleSheets[0].cssRules].findIndex(r => r.selectorText==="*")
document.styleSheets[0].deleteRule(i);

Find more questions by tags HTMLCSSJavaScript