Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<head>
<style>
#ex1 {
  color: red !important;
}
</style>
</head>
<body>
<h1>The getPropertyPriority() Method</h1>
<p>Click the button to return whether or not the color property has the "important!" priority set.</p>
<button onclick="myFunction()">Try it</button>
<div id="ex1">Some text.</div>
<script>
function myFunction() {
  var declaration = document.styleSheets[0].cssRules[0].style;
  var priority = declaration.getPropertyPriority("color");
  alert(priority);
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_cssstyle_getpropertypriority by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 18:00:19 GMT -->
</html>