@w0s/button-checkboxes
v2.2.2
Published
Button to check / uncheck checkboxes group
Downloads
19
Readme
Button to check / uncheck checkboxes group
Demo
Examples
<script type="importmap">
{
"imports": {
"@w0s/button-checkboxes": "..."
}
}
</script>
<script type="module">
import ButtonCheckboxes from '@w0s/button-checkboxes';
for (const targetElement of document.querySelectorAll('.js-button-checkboxes')) {
new ButtonCheckboxes(targetElement);
}
</script>
<button type="button" class="js-button-checkboxes"
data-course="check"
data-control="checkbox-group"
>Check all</button>
<p id="checkbox-group">
<label><input type="checkbox" /> 1</label>
<label><input type="checkbox" /> 2</label>
<label><input type="checkbox" /> 3</label>
</p>
<button type="button" class="js-button-checkboxes"
data-course="check"
data-controls-class="checkbox"
>Check all</button>
<p>
<label><input type="checkbox" class="checkbox" /> 1</label>
<label><input type="checkbox" class="checkbox" /> 2</label>
<label><input type="checkbox" class="checkbox" /> 3</label>
</p>
<button type="button" class="js-button-checkboxes"
data-course="check"
data-controls-name="checkbox[]"
>Check all</button>
<p>
<label><input type="checkbox" name="checkbox[]" /> 1</label>
<label><input type="checkbox" name="checkbox[]" /> 2</label>
<label><input type="checkbox" name="checkbox[]" /> 3</label>
</p>
* uuid
is no longer required since version 2.1