How to target first td of every row with pure JS?
<p>I tried to change the color of the first td element in each row to red.</p>

<p>HTML:</p>

<pre><code>&lt;table id="test"&gt;
&lt;tr&gt;
    &lt;td&gt;test1&lt;/td&gt;
    &lt;td&gt;test2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
    &lt;td&gt;test3&lt;/td&gt;
    &lt;td&gt;test4&lt;/td&gt;
&lt;/tr&gt;

&lt;/table&gt;
</code></pre>

<p>I tried this JS:</p>

<pre><code>var tr = document.getElementsByTagName('tr');

tr.firstChild.style.color = 'red';
</code></pre>

<p>No Jquery please.</p>
