lundi 18 octobre 2021

Check certain checkboxes when toggle is active

Hi I have a form where people need to fill out on what days they work.

I have checkboxes from monday to sunday like this:

<a href="javascript:void(0)" class="form__input"
    @click="setCurrentDay('monday')">
    <input name="checkbox_field0 weekday" id="checkbox_field0" type="checkbox" class="special">
    <label for="checkbox_field0">Monday</label>
</a>

and so on...

Above this there is a toggle people can click if they work monday to friday. When they click this I want the checkboxes monday to friday to be (un)checked.

the toggle:

<div class="toggle-switcher">I work monday to friday</div>

What is the best way to achieve this?




Aucun commentaire:

Enregistrer un commentaire