samedi 24 mars 2018

Is there a way to link checkboxes with parents in html without any javascript?

I know with checkboxes you can have an indeterminate state which has a dash or square dot in it. This is to tell the user it's children checkboxes have some but not 0 or all, selected. Is there a way to link children with parent checkboxes, so the state of the parent will automatically reflect the state of it's children, without javascript? Something like this:

<input type="checkbox" name="parent1"/> Parent 1
    <input type="checkbox" for="parent1"/> Child 1
    <input type="checkbox" for="parent1"/> Child 2
<input type="checkbox" name="parent2"/> Parent 2
    <input type="checkbox" for="parent2"/> Child 1
    <input type="checkbox" for="parent2"/> Child 2

Thanks




Aucun commentaire:

Enregistrer un commentaire