(function(){ function applyFilter() { var active = {}; document.querySelectorAll('.pec-filter input[type="checkbox"]').forEach(function(chk) { active[chk.getAttribute('data-stato')] = chk.checked; }); document.querySelectorAll('tbody tr[data-stato]').forEach(function(tr) { var stato = tr.getAttribute('data-stato'); var show = (stato in active) ? active[stato] : true; tr.style.display = show ? '' : 'none'; }); } document.querySelectorAll('.pec-filter input[type="checkbox"]').forEach(function(chk) { chk.addEventListener('change', applyFilter); }); })();