Jaf*_*Ali 0 html javascript jquery jquery-selectors
我在表格场景中有表格.当我尝试使用trs选择trs时,
$("#table tr");它也会从内部表中选择所有tr.
我怎样才能从外表中选择tr.
请改用:
$('#table > tr'); // choose direct child tr nodes from table with id 'table'
Run Code Online (Sandbox Code Playgroud)
要么
$('#table > tbody > tr');
Run Code Online (Sandbox Code Playgroud)
如果你有tbody元素.
以下是jQuery文档的链接:http://api.jquery.com/child-selector/