js set important style

89

js set important style -

function myFunction() {
    var x = document.querySelectorAll("#testDiv p.example");
    x[0].style.setProperty("background-color", "red", "important");
}

how to add important tag js -

$(".className").each(function () {
	this.style.setProperty('display', 'inline-block', 'important');
}
                     
//jQuery answer to avoid creating functions

Comments

Submit
0 Comments