mardi 24 avril 2018

Requiring at least one selection in a group of checkboxes?

I am using Bootstrap for this. I have a group of buttons which, when pressed, there is a dropdown menu with a list of checkboxes. This is one of the buttons:

<div class="btn-group">
                <button type="button" class="btn dropdown-toggle" data-toggle="dropdown" aria-haspopup="true"
                        aria-expanded="false">
                    Anatomical Area
                </button>
                <div class="dropdown-menu">
                    <a class="dropdown-item"><input type="checkbox" name="head" value="head"> Head</a>
                    <a class="dropdown-item"><input type="checkbox" name="chest" value="chest"> Chest</a>
                    <a class="dropdown-item"><input type="checkbox" name="arms" value="arms"> Arms</a>
                    <a class="dropdown-item"><input type="checkbox" name="legs" value="legs"> Legs</a>
                </div>
            </div>

Is there a way with Bootstrap to require at least one of these checkboxes to be selected?

(There is already a question similar to this using only HTML5, but it seems this can only be done with jquery/javascript)




Aucun commentaire:

Enregistrer un commentaire