There are no tracking or monitoring cookies on this site. There are only cookies used for documentation examples related to cookies.Close
Processing...
This may take a few seconds.

set-property

Syntax

set-property: (property) (boolean|"string") [every (time)] [after (time)][, (property)...];

This command allows you to change the value of a property of an element - not a CSS style property. Just use a regular CSS command if you want to change a style property, or use the "style" command.

Sometimes you need to unset a dynamic property of an element. This command adds a property to the target selector if it doesn't exist, or replaces one if it is already there.

The property parameter is the name of the property you want to use.

The boolean parameter accepts "true" or "false" if your property needs to be true or false. You can can leave out the double-quotes for a boolean. Or alternatively, the string parameter is what you want to set the property to. It requires double-quotes - these are currently not optional.

 

Properties and attributes can sometimes be a bit confusing. But the confusion is in the native terms used rather than the behaviour. There is a distinction there that can be understood, really!

For some of the difference between properties and attributes and recommended use, see this page:

https://www.joji.me/en-us/blog/html-attribute-vs-dom-property/

set-property