English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
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.
object.getPropertyPriority(property)
var declaration = document.styleSheets[0].rules[0].style; var isImportant = declaration.getPropertyPriority('color'); document.getElementById("result").innerHTML = isImportant;Test and see‹/›
All browsers fully support the getPropertyPriority() method:
Method | |||||
getPropertyPriority() | Yes | Yes | Yes | Yes | Yes |
Parameter | Description |
---|---|
property | A string representing the name of the property to be checked |
Return Value: | A string representing the priority, if not present, it is an empty string |
---|---|
DOM Version: | CSS Object Model |