English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSSStyleDeclaration getPropertyPriority() method

 JavaScript CSSStyleDeclaration Object

getPropertyPriority()The method returns whether the given CSS property has set the "!important" priority.

If it returns "important", it indicates that the priority has been set; otherwise, it has not.

Syntax:

object.getPropertyPriority(property)
var declaration = document.styleSheets[0].rules[0].style;
var isImportant = declaration.getPropertyPriority('color');
document.getElementById("result").innerHTML = isImportant;
Test and see‹/›

Browser Compatibility

All browsers fully support the getPropertyPriority() method:

Method
getPropertyPriority()YesYesYesYesYes

Parameter Value

ParameterDescription
propertyA string representing the name of the property to be checked

Technical Details

Return Value:A string representing the priority, if not present, it is an empty string
DOM Version:CSS Object Model

 JavaScript CSSStyleDeclaration Object