所以,我想這一點:在jQuery中,你如何選擇當前表TR而不是任何嵌套表TR?
input.find(" tr").each(function(){ ... });
我也試過這樣:
input.find(" > tr").each(function(){ ... });
這兩個不工作。第一個將選擇任何TR,即使它在嵌套表下。如果桌子有任何東西或其他類似的東西,第二個就不行。任何幫助?
輸入被定義爲:
var input = $(".mySelectionScope");
的DOM應該是這樣的:
<div class='mySelectionScope'>
<div> // Optional
<table>
<tbody>
<tr> // Select this one
<table>
<tr> // Don't select this one
....
我需要在第一個表中的所有TR,只是沒有在嵌套表格任何TR。 – Bill