I need a content filtering system for my website. By checking and unchecking of a checkbox, the according elements should be shown or hidden.
<form>
<p><input type="checkbox" checked="checked"><label>Plants</label></p>
<p><input type="checkbox" checked="checked"><label>Animals</label></p>
<p><input type="checkbox" checked="checked"><label>Humans</label></p>
</form>
The checkboxes above should toggle the visibility of the divs below with the according class, by changing display:block; to display:none;
<div class="Plants" style="display:block">
<p>Grass</p>
<div>
<div class="Humans" style="display:block">
<p>John</p>
<div>
<div class="Plants" style="display:block">
<p>Flower</p>
<div>
<div class="Animals" style="display:block">
<p>Lion</p>
<div>
For example: By uchecking the Plants checkbox, the divs with Grass and Flower should be hidden.
What would be the most elegant way to accomplish that in php or javascript?