基於類類,我堅持挑戰改變背景顏色td元素。下面是HTML代碼,其中有日類稱爲機器人,我已經改變所有的TD的機器人類以下元素的背景顏色。如何根據jquery改變td元素的背景顏色
<table border="1" class="CSSTableGenerator" id="myTable">
<tr>
<th>Component</th>
<th>Properties</th>
<th class="bots">J10</th>
<th>J11</th>
<th>J12</th>
<th>J13</th>
</tr>
<tr>
<td>GenerateAlternateTagUrlDroplet</td>
<td>alternateTagConfiguration</td>
<td class="trueValue">/com//jec/website/seo/</td>
<td class="trueValue">/com//jec/website/seo/</td>
<td class="trueValue">/com//jec/website/seo/</td>
<td class="trueValue">/com//jec/website/seo/</td>
</tr>
<tr>
<td>AlternateTagUrlDroplet</td>
<td>tagConfiguration</td>
<td class="trueValue">/jec/website/seo/</td>
<td class="trueValue">/jec/website/seo/</td>
<td class="trueValue">/jec/website/seo/</td>
<td class="trueValue">/jec/website/seo/</td>
</tr>
</table>
有人可以幫我用jQuery代碼來實現這個嗎?
很多預先感謝。
喜其它表,你將能夠提供你目前的CSS? –
感謝Caelan對此進行調查。那麼,我沒有一個適當的CSS。我只是使用jquery $('。trueValue')。addClass('foo');並在我的CSS文件中,我設置了這樣的背景顏色.foo {background-color:green;}。這僅適用於td元素。 – harshavmb