Add column/cell with class to table based on first cell text using jQuery
<p>I have the following table...</p>

<pre><code>&lt;table&gt;
    &lt;tbody&gt;
         &lt;tr class="trclass"&gt;
             &lt;td class="tdclass"&gt;Test1&lt;/td&gt;
             &lt;td class="tdclass"&gt;Test2&lt;/td&gt;
             &lt;td class="tdclass"&gt;Test3&lt;/td&gt;
         &lt;/tr&gt;
         &lt;tr class="trclass"&gt;
             &lt;td class="tdclass"&gt;Test4&lt;/td&gt;
             &lt;td class="tdclass"&gt;Test5&lt;/td&gt;
             &lt;td class="tdclass"&gt;Test6&lt;/td&gt;
         &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
</code></pre>

<p>How can I add a cell to each row in between (test2 and test3) and (test5 and test6) with a class based on text from the first cells (test1 and test4)? Basically to look like this...</p>

<pre><code>&lt;table&gt;
    &lt;tbody&gt;
        &lt;tr class="trclass"&gt;
            &lt;td class="tdclass"&gt;Test1&lt;/td&gt;
            &lt;td class="tdclass"&gt;Test2&lt;/td&gt;
            &lt;td class="Test1"&gt;NewText&lt;/td&gt;
            &lt;td class="tdclass"&gt;Test3&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr class="trclass"&gt;
            &lt;td class="tdclass"&gt;Test4&lt;/td&gt;
            &lt;td class="tdclass"&gt;Test5&lt;/td&gt;
            &lt;td class="Test4"&gt;NewText&lt;/td&gt;
            &lt;td class="tdclass"&gt;Test6&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
</code></pre>

<p>I've tried things like </p>

<pre><code>jQuery(".tdclass").after("&lt;td&gt;test&lt;/td&gt;");
</code></pre>

<p>and</p>

<pre><code>jQuery(".tdclass").append("&lt;td&gt;test&lt;/td&gt;");
</code></pre>

<p>but I'm not sure how to loop and achieve this exact scenario.</p>
