다음 HTML을 가지고 있습니다.jQuery children() tfoot tr 요소를 선택하지 않았습니다.
<div>
<table></table>
<div><table id="startingPoint"></table></div>
<table><tfoot><tr id="getThis"></tr></tfoot></table>
</div>
find()를 사용하면 #getThis가 예상대로 선택됩니다.
$('#startingPoint').parent().next().find('tfoot tr')
children()을 사용하면 #getThis가 선택되지 않습니다. 왜?
$('#startingPoint').parent().next().children('tfoot tr')
tr 요소는 테이블의 자식이 아니며'children '으로 선택할 수 없습니다. 직접 자식을 검색하지 않으면'find'를 사용해야합니다 –
@Darhazer. tr이 직접적인 아이가 아니라 tfoot tr이 하나라고 해석 될 것으로 예상했다. – user1032531
그래서 $ ('# startingPoint'). parent(). next(). children ('tfoot'). children ('tr')'? – user1032531