Utility methods to change modifier attributes of Onsen UI elements..
ons.modifier.add(myOnsInputElement, 'underbar');
ons.modifier.toggle(myOnsToastElement, 'custom-modifier');
These methods are called directly on the DOM element. Get a reference to the element in JS, and the methods below will be available to call on it. For example: document.querySelector('ons.modifier').someMethod()
.
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 the specified modifiers to the element if they are not already included.
Name | Type | Description |
---|---|---|
element | HTMLElement | Target element. |
modifier | String | Name of the modifier. |
Remove the specified modifiers from the element if they are included.
Name | Type | Description |
---|---|---|
element | HTMLElement | Target element. |
modifier | String | Name of the modifier. |
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.
Name | Type | Description |
---|---|---|
element | HTMLElement | Target element. |
modifier | String | Name of the modifier. |
Toggle the specified modifier.
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. |
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.