TAG
CSS
JavaScript
Result
Run
License
<h1 id="title"> The getPropertyPriority() Method </h1> <button type="button" id="btn-get">Is color property the first priority?</button> <p></p>
#title { color: #0000FF !important; font-weight: normal; } #btn-get { font-size: 15px; } p { color: #FF0000; }
window.addEventListener("load", function() { document.querySelector("#btn-get").onclick = function() { var objStyle = document.styleSheets[1].cssRules[1].style; var isPriority = objStyle.getPropertyPriority("color"); document.querySelector("p").textContent = isPriority; }; });
Console
expand_less
License
License
by DevDic
Close