Skip to content

.addModifier()

esr360 edited this page May 1, 2019 · 4 revisions

Add one or more modifiers to each element in the set of matched elements

.addModifier(modifier, config);
Aliases
  • .add()
  • .addModifiers()
Param Type Info
modifier (String|Array) The modifier(s) to add to each element in the set of matched elements
[config] Object The configuration to use when calling the method (learn more)

Example With Single Modifier

<div class="button" id="alpha">Button</div>
sQuery('#alpha').addModifier('active');
Result
<div class="button-active" id="alpha">Button</div>

Example With Multiple Modifiers

<div class="button" id="alpha">Button</div>

Note the use of .addModifiers() alias

sQuery('#alpha').addModifiers(['disabled', 'error']);
Result
<div class="button-disabled-error" id="alpha">Button</div>
Clone this wiki locally