I'm trying to enable and disable multiple check boxes, when other check boxes are clicked.
I want to disable box1, box2, box3 if any one of Cash or Square or Paypal are checked. Otherwise, I want to box1, box2, box3 to be enabled.
I currently have this code:
var check = $("#checkit1");
$("#checkit1").on('click',checkStatus);
function checkStatus(){
if(check.is(':checked'))
{
$("#click1").prop('disabled', true);
$("#click2").prop('disabled', true);
$("#click3").prop('disabled', true);
}
else{
$("#click1").prop('disabled', false);
$("#click2").prop('disabled', false);
$("#click3").prop('disabled', false);
}
}
<br>
<div>
<input type="checkbox" id="checkit1" /> Cash <br>
<input type="checkbox" id="checkit2" /> Square <br>
<input type="checkbox" id="checkit3" /> Paypal <br>
------------------------------------------------<br>
<input type="checkbox" id="checkit4" /> BBT <br>
<input type="checkbox" id="checkit5" /> Citi <br>
**<input type="checkbox" id="click1" /> dep <br>
**<input type="checkbox" id="click2" /> trans <br>
**<input type="checkbox" id="click3" /> check <br>
</div>
What am I doing wrong?