Cannot set the background color of "TD" using JQuery
<p>I have a table as under</p>

<pre><code>&lt;table &gt;
        &lt;tr&gt;
            &lt;th scope="col"&gt;EmpId&lt;/th&gt;&lt;th scope="col"&gt;EmpName&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;1&lt;/td&gt;&lt;td&gt;ABC&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;2&lt;/td&gt;&lt;td&gt;DEF&lt;/td&gt;
        &lt;/tr&gt;
&lt;/table&gt;
</code></pre>

<p>I want to set the background color of only the <strong>"td"</strong> elements of the table and not <strong>"th"</strong>. I have tried with</p>

<pre><code>$("table").children("td").css('background-color', '#00ff00');

OR



$("table").children("tr").children("td").css('background-color', '#00ff00');
</code></pre>

<p>But with no result. </p>

<p>Please help as what mistake I am doing?</p>

<p>Thanks</p>
