I'm looking for a way to hide information in a toggle div until a "no" checkbox is clicked. I need a simple jQuery code that can be used for each instance independently, where the divs will only show when a "no" answer is checked. Any help or feedback would be greatly appreciated!
<div>
<ul class="rank">
<li>
<label>Do you enjoy the color blue?</label>
<fieldset>
<label><input class="no" type="checkbox" /> No</label>
<label><input class="yes" type="checkbox" /> Yes</label>
</fieldset>
<div class="toggle">
No, I do not like the color blue!
</div>
</li>
<li>
<label>Do you enjoy the color red?</label>
<fieldset>
<label><input class="no" type="checkbox" /> No</label>
<label><input class="yes" type="checkbox" /> Yes</label>
</fieldset>
<div class="toggle">
No, I do not like the color red!
</div>
</li>
<ul>
</div>
<script type="text/javascript">
$(".toggle").hide();
$(".no").click(function() {
if($(this).is(":checked")) {
$(".toggle").show(500);
} else {
$(".toggle").hide(500);
}
});
</script>