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) [every (time)] [after (time)][, (class)...];

time = Time in standard CSS time format, eg. 1s = 1 second, 250ms = 250 milliseconds.

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