I have 2 divs with check boxes nested in each. I basically would like to trigger an alert if a checkbox is clicked in the 1st one and second one, but I cannot seem to reach that scope. The checkboxes are classes.
if ($("#result1 .tb2:checked").length == 1 && ($("#result2 .tb4:checked").length == 1 ) {
alert("both clicked");
}
<script src="http://ift.tt/1g1yFpr"></script>
<div id="result1">
<input type="checkbox" class="tb1" /> Yes<br><input type="checkbox"class="tb2" /> No<br><br></div><br>
</div>
<div id="result2">
<input type="checkbox" class="tb3" /> Yes<br><input type="checkbox"class="tb4" /> No<br><br></div><br>
</div>
Aucun commentaire:
Enregistrer un commentaire