0
已經過了5個小時,因爲我正在爲此苦苦掙扎,我在上下搜索。我正在嘗試更改包含CHECKED RADIO的TABLE CELL BACKGROUND。 我管理添加背景類,但我不能刪除它的背景時,未選中。Jquery - 刪除課堂上的CHECKED/UNCHECKED無線電按鈕
這裏是代碼我使用:
反正去除背景後級無線電未選中?我沒有做到這一點。 謝謝!
已經過了5個小時,因爲我正在爲此苦苦掙扎,我在上下搜索。我正在嘗試更改包含CHECKED RADIO的TABLE CELL BACKGROUND。 我管理添加背景類,但我不能刪除它的背景時,未選中。Jquery - 刪除課堂上的CHECKED/UNCHECKED無線電按鈕
這裏是代碼我使用:
反正去除背景後級無線電未選中?我沒有做到這一點。 謝謝!
$("td input:not(:checked)")
僅將事件綁定到未檢查的元素。
將它綁定到所有td input
元素並在回調中使用this.checked
來訪問已檢查的狀態。
下面是一個例子:http://jsfiddle.net/ceWbW/5/
$("td input").change(function() {
var $this = $(this);
var td = $this.parent();
// un-green all columns which contain a radio element from the same group
td.siblings().filter(function() {
return !!$(this).find('input[name="'+$this.attr('name')+'"]:radio').length;
}).removeClass('green');
// green the current column in case the radiobox is enabled
if(this.checked) {
td.addClass('green');
}
});
驚人的,非常感謝!現在是時候解決我的頭痛! – user1243801 2012-03-01 21:57:39