2011-04-13 82 views

回答

5

你可能要像

但我不能完全肯定 - 你能澄清或提供一個例子嗎?

+0

是的,就是這樣。謝謝 – Homam 2011-04-13 11:27:50

1

嘗試了這一點:

$('td#id').closest('table') 
2

使用jQuery closest

使用下面的示例代碼

<table id="test"> 
    <tr> 
     <td id="one">one</td> 
    </tr> 
</table> 
<table> 
    <tr> 
     <td id="two">two</td> 
    </tr> 
</table> 

$(document).ready(function(){ 

    var table = $("#one").closest('table'); 

}); 

example here