Note that there are some explanatory texts on larger screens.

plurals
  1. POSearching columns html table
    text
    copied!<p>I have created a table with HTML and want to integrate a search box that can search 4 columns(name,name2,last_name,last_name2). I tried to find 1 column but after writing the next column is not showing anything </p> <p>For example I want to: </p> <pre><code> find name and last_name find name2 and last_name2 find last_name and name2 find name and last_name and name2 </code></pre> <p>In others words no matter the order but after pressing the key "SPACE" is not showing results.</p> <p>Here is my problem:</p> <pre><code>&lt;input type="text" id="filter" /&gt; &lt;table id="table"&gt; &lt;tr&gt; &lt;td&gt;foo&lt;/td&gt; &lt;td&gt;1&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;bar&lt;/td&gt; &lt;td&gt;2&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;some&lt;/td&gt; &lt;td&gt;3&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;other&lt;/td&gt; &lt;td&gt;4&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>Here is my Javascript:</p> <pre><code> // Function function filterTable(value) { if (value != "") { $("#table tbody&gt;tr").hide(); $("#table td:contains-ci('" + value + "')").parent("tr").show(); } else { $("#table tbody&gt;tr").show(); } } // jQuery expression for case-insensitive filter $.extend($.expr[":"], { "contains-ci": function (elem, i, match, array) { return (elem.textContent || elem.innerText || $(elem).text() || "").toLowerCase().indexOf((match[3] || "").toLowerCase()) &gt;= 0; } }); // Event listener $('#filter').on('keyup', function () { filterTable($(this).val()); }); </code></pre> <p>Please someone knows how to resolve this?</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