寫一個擴展名爲tablesorter ..雖然它是我第一次嘗試擴展任何js。我有許多<select>
s在一行<td>
s &需要知道此td所在的列。從td取得列號
當這些選擇中的任何一個選擇值發生變化時,
$('select').change(function(){
});
我需要獲得此列選擇的是保留坐在在設置col
爲:
('tr.result > td:nth-child('+col+')').each(function(){
有沒有一種方法可以讓我從TD得到這個選擇是? ?
- 我的具體問題 的解決辦法是:
$('select').change(function(){
td = $(this).parent('td');
col = $(td).parent().children().index(td);
});
文檔:http://api.jquery.com/index/ – singles 2012-08-17 13:22:47