我目前有一個表,它是我的數據庫結果中的while循環。在我的表格行中,它包含的值將是+或 - 天數。我試圖創建一個jQuery腳本,它將查明td是否包含(「 - 」)或(「+」),並且我希望它將css樣式應用於該行的第一個td。目前它適用於全部行的每個第一個td。如何讓jQuery將類應用到連續的第一個td
$("tr td:nth-child(7):contains('+')").each(function() {
$('tr td:first-child').css('background-color', 'blue');
});
由於這個工作。 – TheGambit 2012-08-06 10:05:59
@TheGambit沒問題,如果這對你有幫助,請接受答案。 http://meta.stackexchange.com/a/5235/151209 – Curt 2012-08-06 10:51:07