<input id="a1" type="checkbox">
<label for="a1">1</label>
<input id="a2" type="checkbox">
<label for="a2">2</label>
<input id="a3" type="checkbox">
<label for="a3">3</label>
<input id="a4" type="checkbox">
<label for="a4">4</label>
<input id="a5" type="checkbox">
<label for="a5">5</label>
<script>
$(function()
{
disabledOtherBox();
$("#a1").click(disabledOtherBox);
disabledA1Box();
$("#a2,#a3,#a4,#5").click(disabledA1Box);
});
function disabledOtherBox()
{
if (this.checked)
{
$("#a2,#a3,#a4,#a5").attr("disabled", true);
}
else
{
$("#a2,#a3,#a4,#a5").removeAttr("disabled");
}
}
function disabledA1Box()
{
if (this.checked)
{
$("#a1").attr("disabled", true);
}
else
{
$("#a1").removeAttr("disabled");
}
}
</script>
The above are the conditions I wrote
If a1 is checked
a2~5 is locked
If one of a2~a5 is checked
, then a1 is locked
I want to add another condition but I still can’t figure it out
That is, assuming that one of a2~5 is checked (or two, three, or four are all checked)
Then a1 Just lock it
Unless a2~5 are not checked
, a1 will be opened