title: Create Function to search entire table and not one column only
body: <p>I have a table with a search function. Initially, my intention was to only search the contents of the first column. I would like to change this and create a search function that searches the entire table.</p>
  <p><strong>Below is a snippet of the current code for it:</strong></p>
  <pre><code>&lt;script&gt;
  function myFunction() {
    // Declare variables
    var input, filter, table, tr, td, i, txtValue;
    input = document.getElementById(&quot;myInput&quot;);
    filter = input.value.toUpperCase();
    table = document.getElementById(&quot;userinfo&quot;);
    tr = table.getElementsByTagName(&quot;tr&quot;);
    
    // Loop through all table rows, and hide those who don't match the search query
    for (i = 0; i &lt; tr.length; i++) {
      td = tr[i].getElementsByTagName(&quot;td&quot;)[1];
      if (td) {
        txtValue = td.textContent || td.innerText;
        if (txtValue.toUpperCase().indexOf(filter) &gt; -1) {
          tr[i].style.display = &quot;&quot;;
        } else {
          tr[i].style.display = &quot;none&quot;;
        }
      }
    }
  }
  &lt;/script&gt;
  </code></pre>
  <p>I am using onkeyup in a text field to call the function</p>
  <p>Below is the current code for it.</p>
  <pre><code>&lt;input type=&quot;text&quot; id=&quot;myInput&quot; onkeyup=&quot;myFunction()&quot; placeholder=&quot;Search for Address&quot; title=&quot;Search for Address&quot;&gt;
  </code></pre>
  <p>Please help me implement a search function that searches the entire table and hides the rows that done match the input.</p>
  <p>regards,</p>