dimanche 27 décembre 2015

Binding two checkboxes together

I have two checkboxes

<input class="checkbox1" type="checkbox" name='1' id="example1" value="example1"/> 

and

<input class="checkbox2" type="checkbox" name='2' id="example2" value="example2"/>

Is it possible to connect these two checkboxes, so that whatever happens to the 'checked' attribute of one checkbox also happens to the other? It needs to work for

  1. User changes the checked status

  2. Some javascript function changes the checked status

My actual example is very complex and has many many checkboxes. So I am looking for a solution where I can just determine a connection between two checkboxes and never have to think about it again. thanks carl




Aucun commentaire:

Enregistrer un commentaire