我有一個HTML表格Jquery-查找元素賦予樣式屬性
<table class="mytable">
<tr>
<td>
test value
</td>
<tr>
</table>
上
$(".mytable tr:first").append("<td id='scheduledInMyLearnStatus' class='changeFieldValue' style='background-color:#FE2E2E;'></td>");
現在載入的頁面動態地添加一個TD上點擊特定TD我想比較它是否已經backgroung顏色=#FE2E2E 或具有其他任何
$('td').live('click', function() {
//compare here
});
http://api.jquery.com/css/ - 用於獲取一個css的價值屬性。試一試:)例如$(元素)的.css( '背景色') – nbrooks 2012-08-03 06:40:42