Just dipping my toes into jQuery, so bear with me...
I have 3 checkboxes and I'm trying to hide a specific tag if one of the checkboxes is checked. But, I want all the other tags to become visible if they are not checked. Additionally, if 2 checkboxes are checked, I need to hide all associated tags.
I hope this explanation makes sense, and any assistance is greatly appreciated!
Thank you in advance
<input type="checkbox" class="example" id="check1"><label>check1</label>
<input type="checkbox" class="example" id="check2"><label>check2</label>
<input type="checkbox" class="example" id="check3"><label>check3</label>
<a class="check1" href="">check1</a>
<a class="check2" href="">check2</a>
<a class="check3" href="">check3</a>
<a class="check1" href="">check1</a>
<a class="check2" href="">check2</a>
<a class="check3" href="">check3</a>
<a class="check1" href="">check1</a>
<a class="check2" href="">check2</a>
<a class="check3" href="">check3</a>
.hide {
display: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script>
<script>
$('#check1').change(function() {
if ($(this).is(":checked")) {
$(".check1").addClass("hide");
} else {
$(".check1").removeClass("hide");
}
});
</script>