Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This should work fine:</p> <pre><code>&lt;div&gt; &lt;button type="button" id="filterTablesbtn"&gt;Filter&lt;/button&gt; &lt;button type="button" id="clearFilterbtn"&gt;Clear Filter&lt;/button&gt; &lt;/div&gt; ABC1 &lt;table id="ABC1"&gt; &lt;tr&gt; &lt;td&gt;Test&lt;/td&gt;&lt;td&gt;&lt;input type="checkbox"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Test 2&lt;/td&gt;&lt;td&gt;&lt;input type="checkbox" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; ABC2 &lt;table id="ABC2"&gt; &lt;tr&gt; &lt;td&gt;Test&lt;/td&gt;&lt;td&gt;&lt;input type="checkbox"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Test 2&lt;/td&gt;&lt;td&gt;&lt;input type="checkbox" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; ABC3 &lt;table id="ABC3"&gt; &lt;tr&gt; &lt;td&gt;Test&lt;/td&gt;&lt;td&gt;&lt;input type="checkbox"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Test 2&lt;/td&gt;&lt;td&gt;&lt;input type="checkbox"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; window.onload = function() { $('#filterTablesbtn').click(function(){ filterTable('ABC1'); filterTable('ABC2'); }); $('#clearFilterbtn').click(function(){ clearFilter('ABC1'); clearFilter('ABC2'); }); } function filterTable(id) { $('#' + id + ' tr').each(function(){ if($(this).find('input[type=checkbox]').is(":checked")) $(this).hide(); }); } function clearFilter(id) { $('#' + id + ' tr').show(); } </code></pre> <p>See the fiddle here: <a href="http://jsfiddle.net/SpAm/pSzk7/" rel="nofollow">http://jsfiddle.net/SpAm/pSzk7/</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload