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-class

Syntax

set-class: ["](class)["] [every (time)] [after (time)];

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

This command replaces all classes within the class attribute of the target selector with one specified class or a set of classes, space delimited.

The following example will replace whatever classes are set in the element "myButton" with the classes "onlyClass" when the button is clicked:

#myButton:click {
    set-class: .onlyClass;
}

But the syntax for this command is quite flexible as it removes dots and quotes before setting the class(es). So you can use quotes if you prefer:

#myButton:click {
    set-class: "aClass anotherClass";
}

or

#myButton:click {
    set-class: ".aClass .andThis alsoThis";
}

set-class