toggle( )


Toggles an element's custom CSS class.

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.
Method Declaration
Copy
Method Parameters
classNamestringRequired

The custom class to toggle.

Returns
Return Type:boolean
Was this helpful?
Yes
No