我試圖計算一個tbody
中的td
的數目,其中有white background-color
。我需要在計數後更新span
的文字。類的我span
是.attendenceCount
tbody中計數tr,具有一定的風格特徵
$(".attendenceCount").closest('tbody')...
HTML
<table>
<thead>
<tr>
<th>Søløve 16:50-17:30 (3017) <span style="color:black;" class="attendenceCounter">tmp</span>
</th>
</tr>
</thead>
<tbody>
<tr style='background-color:white;'>
<td>Albert Hvistendahl Fabel</td>
</tr>
<tr style='background-color:green;'>
<td>Albert Hvistendahl Fabel</td>
</tr>
<tr style='background-color:white;'>
<td>Albert Hvistendahl Fabel</td>
</tr>
<tr style='background-color:green;'>
<td>Alma Valbjørn Bratved</td>
</tr>
<tr style='background-color:white;'>
<td>Albert Hvistendahl Fabel</td>
</tr>
</tbody>
</table>
這怎麼有可能?
背景顏色是在「bgcolor」中定義的內嵌顏色還是通過CSS定義的?它是「白色」「白色」還是「ffffff」? –
它被定義爲'White'via CSS –
顯示你的HTML會有所幫助。 –