I am wanted to be able to filter a table with checkboxes this is what I came up with, but it seems not to work.
Basiclly I want the table to hide the one that are not checked and show the ones that are. HTML CODE
<div class="tags">
<label><input type="checkbox" rel="a" /> a </label>
<label><input type="checkbox" rel="x" /> x </label>
</div>
<table>
<thead>
<tr><th>list</th></tr>
</thead>
<tbody>
<tr><td>a</td></tr>
<tr><td>a</td></tr>
<tr><td>b</td></tr>
<tr><td>a</td></tr>
<tr><td>x</td></tr>
</tbody>
</table>
JS code
$('div.tags').delegate('input:checkbox', 'change', function()
{
var $lis = $('table tbody > tr').hide();
//For each one checked
$('input:checked').each(function()
{
$lis.filter('.' + $(this)).show();
});
}).find('input:checkbox').change();
Am wondering if I am doing something wrong?