this might be easier
var puts = $('.a');//get checkboxes
var cans = $('.field');//get content
puts.on('change', function() {//when checkbox changes
if (!puts.filter(':checked').length) {//if nothing's checked
cans.show();//show it all
} else {//if something's checked
cans.hide();//hide all
puts.filter(':checked').each(function() {//get checked
$('.'+this.id+':hidden').show();//show if hidden
});
}
});
made a fiddle: http://jsfiddle.net/filever10/F8Vk2/
breakdown
puts
is the checkboxes
cans
is the content blocks
When a checkbox state changes, if nothing is currently checked it shows everything. If something is checked it hides all content blocks and shows any that have a class that matches the id
of a checked box. It only shows things that are hidden, so it doesn't have to run show multiple times on content blocks that apply to multiple checked boxes.