lundi 21 décembre 2015

jQuery if checkbox is checked diasble other checkbox

I have HTML code:

<input type="checkbox" name="all" value="all">ALL <input type="checkbox" name="agent" value="agent" >Agent <input type="checkbox" name="company" value="company">Company <input type="checkbox" name="branch" value="branch">Branch

If I check all, other checkbox becomes disabled, if I uncheck, other checkbox is back enabled. I have tried doing this, using the Script below.

$("input[name='all']").change(function() { if(this.checked) { $("input[name='agent']").prop("disabled",true); } });




Aucun commentaire:

Enregistrer un commentaire