CSSStyleDeclaration getPropertyPriority() Method

CSS CSSStyleDeclaration CSS CSSStyleDeclaration

Example

Return whether the color property has the "important!" priority set:

var declaration = document.styleSheets[0].cssRules[0].style; var priority = declaration.getPropertyPriority("color"); alert(priority);

Try it Yourself »

Definition and Usage

The getPropertyPriority() method returns whether the specified CSS property has the "important!" priority set. If it returns "important", it means the priority is set; otherwise it is not.


Browser Support

Method
getPropertyPriority() Yes 9.0 Yes Yes Yes

Syntax

object.getPropertyPriority(propertyname)

Parameter Values

Parameter Description
propertyname Required. A string representing the property name to check.

Technical Details

DOM Version: CSS Object Model
Return Value: A string, indicating that the priority is set; if empty, it means no priority is set.

CSS CSSStyleDeclaration CSS CSSStyleDeclaration

Other Extensions