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.

Authorization

Request

This endpoint does not take any parameters

Response Object

Returns an empty object.

Status/Error Codes

Was this helpful?

Toggle to add a missing class

Copy Code
1$w("#myElement").customClassList.toggle("className1") // true