Search.../

Introduction

This property is not yet available to all users.

CustomClassList is a mixin that provides functionality for manipulating an element's custom CSS classes. For example, you can add a custom class to an element or replace an existing class with a new custom class.

Custom classes are those that you define for your site, not the predefined global classes that are provided for each element.

You define custom CSS classes in the global.css file which can be accessed in the Page Code section of the Editor. For more information on defining custom classes, see Add CSS to your site and About CSS editing.

Note: This mixin is currently only available in Editor X.

About Mixins

Mixins provide functionality that other elements can inherit and use.

Mixins are not elements. You cannot add mixins to a page in the Editor like other $w elements, and mixins are not meant to be used directly in your code. For example, you would not write code like this, because it is out of context:

let myClasses = $w("#CustomClassList").customClassList.values();
js | Copy Code

Instead, you can code the following if myElement is an element that "mixes in" CustomClassList mixin.

let myClasses = $w("#myElement").customClassList.values();
js | Copy Code

Note: This mixin only affects custom classes. If you use it for global classes, there is no effect on the element.

Was this helpful?