dimanche 1 février 2015

Dynamically disabled some checkbox options using jquery and php


<input type="checkbox" name="pref[]" value="red//fuji" />Fuji
<input type="checkbox" name="pref[]" value="red//pinklady" />Pink Lady
<input type="checkbox" name="pref[]" value="red//reddelicious" />Red Delicious
<input type="checkbox" name="pref[]" value="green//grannysmith" />Granny Smith
<input type="checkbox" name="pref[]" value="green//goldendelicious" />Golden Delicious


I would like to dynamically disable group of checkbox, for example if either green apple checkboxes is checked, the three red apples checkboxes will be disabled. I would also like the checked checkbox remain checked even after the disabling.


In my real scenario, I will be populating the checkbox options from a MySQL database, so how can I achieve this using HTML, PHP and jQuery or any other ways?





Aucun commentaire:

Enregistrer un commentaire