Search...
toggle( )
Toggles an element's custom CSS class.
Description
The toggle()
function either adds or removes an element's custom CSS class.
- Returns
false
when an existing custom class gets removed from the element's class list. - Returns
true
when the custom class gets added to the element's class list.
Syntax
function toggle(className: string): boolean
toggle Parameters
NAME
TYPE
DESCRIPTION
className
string
The custom class to toggle.
Returns
Return Type:
boolean
Was this helpful?
Toggle to add a missing class
Copy Code
1$w("#myElement").customClassList.toggle("className1") // true