我需要通过其属性找到一个tr,rowIndex等于某个特定值。 rowIndex不是属性
我试过了,
$(table).find('tr[rowIndex = 1]')
但没有运气
请帮忙
答案 0 :(得分:1)
您需要在引号中包含table
以选择<table>
元素。
$('table').find('tr[rowIndex = 1]')
您也可以使用
选择元素$('table tr[rowIndex=1]')
答案 1 :(得分:1)
如果您正在寻找表格的第一个tr
孩子,请使用first-child
$('table').find('tr:first-child')
如果要根据dom属性(而不是元素属性)进行过滤,那么
$('table').find('tr').filter(function () {
return this.rowIndex == 1
})
答案 2 :(得分:1)
尝试:eq()
$('table').find('tr:eq(1)')
答案 3 :(得分:0)
我认为你可以通过
找到
$('table tr').filter("[rowIndex=1]");
&#13;
这也是..!