I have a form with multiple checkboxes like this:
<form id="myForm">
<input type="checkbox" id="first" />
<input type="checkbox" id="second" />
<input type="checkbox" id="third" />
</form>
I want to do something (i.e. alert box) only when checkbox 1 and 3 are selected.
I know how to target one check box like this:
$('#first').click(function () {
if ($(this).prop("checked") == true) {
alert("I'm checked!");
}
});
But is there a way to do that for specific multiple checkboxes?
Aucun commentaire:
Enregistrer un commentaire