[jQuery] how to loop over checkboxes and hide the UNchecked ones?
I've got a series of topics - each with a list of checkboxes.
Topic
0 item 1
0 item 2
0 item 3
When the user clicks the topic - I have the checklist show/hide using
toggle(). What I'd like is when the list closes - the 'checked' items
remain visible.
Topic
X item 2
X item 3
I'm struggling with how to loop through the list of checkboxes?? My
attempt to use .each() isn't working??
$('h3').click(function() {
// $(this).next().toggle("fast");
// $(this).toggleClass('down').toggleClass('right');
$('input:checkbox').each( function() {
var checked_status = this.checked;
if (!checked_status)
{
$(this).hide();
}
});
});
Thanks,
Jim