Jamie Peregrym Jamie Peregrym - 7 months ago 29
HTML Question

Filter table using values in specific column

I am trying to filter a table using javascript to only show rows which have more then 5 seeders. Here is a link to a JSFiddle with an example of the table.


Example of one row:

<td align=left width=500><NOBR><a href="download.php?id=1241487&SSL=1"><img style="position: relative; top: 2px;" src="themes/classic/pic/download.gif.pagespeed.ce.6SI31hDpjb.gif" border="0"></a>&nbsp;<a class="index" href="details.php?id=1241487&amp;hit=1">CENTOS 4</a> (<b><font color="red">NEW!</font></b>)</NOBR><br/><font size=1 color='666666'><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Uploaded 13 m, 44 seconds after pre</i></font></td>
<td align="right"><b><a href="details.php?id=1241487&amp;hit=1&amp;filelist=1">78</a></b></td>
<td align="right">0</td>
<td align=center><nobr>2016-08-17<br/>23:23:27</nobr></td>
<td align=center>----</td>
<td align=center>6.64<br/>GB</td>
<td align=center>----</td>
<td align="right"><span class="green">2</span></td>
<td align="right"><span class="green">2</span></td>


You can do something like this:

Array.from(document.querySelectorAll("tr")).forEach(function(v, k){
    var seeders = v.querySelectorAll("td")[8].textContent;
    if(seeders < 5){
        v.style.display = "none";

What this will do is to check the content of 9th column in each row and if the value in this column is smaller then 5, hide the row.