[英]jquery selector with >
<table>
<tr num="1"></tr>
<tr id="a" num="2"></tr>
<tr num="3"></tr>
<tr num="2"></tr>
<tr num="1"></tr>
</table>
$('#a').nextUntil('tr[num > 1]')
How can I implement the above query with JQuery 1.4.2 in which the first parameter for nextUntil() is selector and not JQuery object? 如何使用JQuery 1.4.2实现上述查询,其中nextUntil()的第一个参数是选择器而不是JQuery对象?
I was thinking on something like: 我在想类似的东西:
$(some tr id).nextall().filter(function () {return $(this).attr('num') > 1;});
But if there are many tr it could take some time. 但是,如果有很多tr,可能需要一些时间。 Any suggestions?
有什么建议么?
You could the .each function: 您可以使用.each函数:
$("tr").each(function(index, value)
{
if ($(value).attr('num') > 1)
{
// do sth. with it
}
});
Or maybe also by jquery additional greater than selector 或者也可以通过jquery附加大于选择器
:gt(index)
But this should be really tricky, filtering this way. 但这确实很棘手,以这种方式过滤。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.