title: Search values from first column in html table using JS?
body: <p>I have this table</p>
  
  <pre><code>&lt;th&gt;Example No.&lt;/th&gt;
  &lt;th&gt;Column 1&lt;/th&gt;
  &lt;tr&gt;
  &lt;td id="SampleId"&gt;3512376894&lt;/td&gt;
  &lt;td&gt;two.test2@hotmail.com&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>I have script that search the values by all columns. But all I want to do is search the values by first column only with td id. But I don't know how to do that. Please kindly, help me to do that? Thanks! </p>
  
  <p><a href="http://jsfiddle.net/rjhxrb20/5/" rel="nofollow">Here's the jsfiddle file</a></p>
  
  <p>Here's the JScript:</p>
  
  <pre><code>function doSearch() {
          var searchText = document.getElementById('searchTerm').value;
          var targetTable = document.getElementById('dataTable');
          var targetTableColCount;
          for (var rowIndex = 0; rowIndex &lt; targetTable.rows.length; rowIndex++) {
              var rowData = '';
              if (rowIndex == 0) {
                  targetTableColCount = targetTable.rows.item(rowIndex).cells.length;
                  continue; //do not execute further code for header row.
              }
              for (var colIndex = 0; colIndex &lt; targetTableColCount; colIndex++) {
                  rowData += targetTable.rows.item(rowIndex).cells.item(colIndex).textContent;
                  if (rowIndex &lt;= 1) {
                      document.getElementById('noresults').style.display = "block";
                  }
              }
          }
      }
  </code></pre>