Change text color based on td value
<p>I have a table that returns values from my Mysql database without issue.  What I want to do is change the font color to green if two of the five values is selected from radio buttons.</p>

<p>The field that I wish to change the color is the "Category" field if the value is either Vegetarian or Vegan.  All other options will be the default color (black).</p>

<p>This is my code that displays the table data, which is displaying as I wish:</p>

<pre><code>$richOutput = widgets\RichText::widget(['text' =&gt; $post-&gt;message,     'record' =&gt; $post]);
$richOutput_rname = widgets\RichText::widget(['text' =&gt; $post-&gt;rname, 'record' =&gt; $post]);
$richOutput_category = widgets\RichText::widget(['text' =&gt; $post-&gt;category, 'record' =&gt; $post]); ?&gt;
&lt;table&gt;
&lt;tr&gt;&lt;td&gt;&lt;span id="post-content-&lt;?php echo $post-&gt;id; ?&gt;" &lt;?php print $richOutput; ?&gt;&lt;/span&gt;&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;span id="post-content-rname-&lt;?php echo $post-&gt;id; ?&gt;" &lt;?php print $richOutput_rname; ?&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;span id="post-content-category-&lt;?php echo $post-&gt;id; ?&gt;" &lt;?php print $richOutput_category; ?&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
</code></pre>

<p>Thank you in advance!</p>

<h2>Edit</h2>

<p>I tried to add the following JS, but it did not change the text color when the value = "Vegan":</p>

<pre><code>    &lt;script type="text/javascript"&gt;
$('.cat').each(function(i, n) {
   if($(n).text() = "Vegan") $(n).css('color', '#8A1010');
});
&lt;/script&gt;
</code></pre>