I work with XUL and I have two hboxes in each there is one checkbox :
<hbox id="hBox1">
<label value="label1" style="width:15ex" />
<spacer style="width:5px" />
<checkbox id="checkBox1" style="width: 2ex" />
</hbox>
<hbox id="hBox2">
<label value="label2" style="width:15ex" />
<spacer style="width:5px" />
<checkbox id="checkBox2" style="width: 2ex" />
</hbox>
I want to have this behaviour : only one of the two chekboxes can be checked i.e. if the user checks one checkbox whereas the other is checked, then the second checkbox must be automatically unchecked
I tried this :
<checkbox id="checkBox1" style="width: 2ex" onchange="if (this.checked) document.getElementById('checkBox2').checked = false" />
<checkbox id="checkBox2" style="width: 2ex" onchange="if (this.checked) document.getElementById('checkBox1').checked = false" />
but it does not work
Aucun commentaire:
Enregistrer un commentaire