Get all rows from dynamical table jQuery
<p>I am trying to read all rows from a dynamic table. The main idea is to read all the rows and store it in an array for further processing. But so far I have not been able to get the row data.  The code below only returns the table headers. </p>

<p>Here is the code:</p>

<pre><code>var data = [];

var i = 0;

$('#tempTable td').each(function (index, tr) {
    var tds = $(tr).find('td');

    if (tds.length &gt; 1) {
        data[i++] = {
            action: tds[0].textContent,
            spec: tds[1].textContent,
            data: tds[2].textContent,
            unit: tds[3].textContent,
            upper_tol: tds[4].textContent,
            lower_tol: tds[5].textContent,
            tol_unit: tds[6].textContent,
            def: tds[7].textContent
        }
    }
});
</code></pre>

<p>And the HTML markup looks like this:</p>

<pre><code>&lt;table id='tempTable'&gt;
    &lt;thead&gt;
        &lt;tr&gt;
            &lt;td class='table_head' width='80px'&gt;Header1&lt;/td&gt;
            &lt;td class='table_head' width='435px'&gt;Header2&lt;/td&gt;
            &lt;td class='table_head' width='100px'&gt;Header3&lt;/td&gt;
            &lt;td class='table_head' width='100px'&gt;Header4&lt;/td&gt;
            &lt;td class='table_head' width='100px'&gt;Header5&lt;/td&gt;
            &lt;td class='table_head' width='100px'&gt;Header6&lt;/td&gt;
            &lt;td class='table_head' width='100px'&gt;Header7&lt;/td&gt;
            &lt;td class='table_head' width='80px'&gt;Header8&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;!-- Rows inserted dynamically here using jQuery --&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
</code></pre>