up.element up.element.toggleClass(element, className, [newPresent])
JavaScript function

This feature has been deprecated. Use Element#classList.toggle(className) instead.

Load unpoly-migrate.js to polyfill deprecated features.

Adds or removes the given class from the given element.


Parameters

element
required

The element for which to add or remove the class.

Type: Element
className
required

The class which should be added or removed.

Type: string
[newPresent]
optional

Pass true to add the class to the element or false to remove it.

If omitted, the class will be added if missing and removed if present.

Type: Boolean