$ons.modifier

Utility methods to change modifier attributes of Onsen UI elements..

Usage


ons.modifier.add(myOnsInputElement, 'underbar');
ons.modifier.toggle(myOnsToastElement, 'custom-modifier');
Signature Description
add(element, modifier [, modifier]) Add the specified modifiers to the element if they are not already included.
remove(element, modifier [, modifier]) Remove the specified modifiers from the element if they are included.
contains(element, modifier) Check whether the specified modifier is included in the element.
toggle(element, modifier [, force]) Toggle the specified modifier.
add(element, modifier [, modifier])

Add the specified modifiers to the element if they are not already included.

Parameters
Name Type Description
element HTMLElement Target element.
modifier String Name of the modifier.
remove(element, modifier [, modifier])

Remove the specified modifiers from the element if they are included.

Parameters
Name Type Description
element HTMLElement Target element.
modifier String Name of the modifier.
contains(element, modifier): Boolean

Check whether the specified modifier is included in the element.

Returns: true when the specified modifier is found in the element’s modifier attribute. false otherwise.

Parameters
Name Type Description
element HTMLElement Target element.
modifier String Name of the modifier.
toggle(element, modifier [, force])

Toggle the specified modifier.

Parameters
Name Type Description
element HTMLElement Target element.
modifier String Name of the modifier.
force String If it evaluates to true, add specified modifier value, and if it evaluates to false, remove it.

Need Help?

If you have any questions, use our Community Forum or talk to us on Discord chat. The Onsen UI team and your peers in the community will work together to help solve your issues.

For bug reports and feature requests use our GitHub Issues page.