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.

take-class

Syntax

take-class: (class) [scope(selector)] [every (time)] [after (time)][, (class)...];

class = The class to "take" from other elements in the DOM that have the class.

scope = An optional selector that limits the taking of the class to elements contained under that selector, and leaves any other element in the DOM alone that may have the class.

This command removes the class specified from any elements or nodes in the target selector's document that have it set in their class attribute, and then adds the specified class to the target selector. The effect is to "take" the class from any other element or elements that have it.

The following example will take the "menuSelected" class from any other elements that may already have the "menuSelected" class, and assign the class to the element clicked (which is a menu button that shares the class "menuItem" with other menu buttons):

.menuItem:click {
take-class: .menuSelected;
}

take-class

take-class with a scope