获取可见且没有属性的下一个元素 [英] Get Next Element that is Visible and Does Not Have Attribute

查看:85
本文介绍了获取可见且没有属性的下一个元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名经验丰富的开发人员,在jQuery方面经验不足。

I'm an experienced developer with not so much experience in jQuery.

我有一个表行(< tr> )元素,我想使用jQuery获取 A)可见的下一个表格行, B)没有属性 id ='count-me-out'

I have a table row (<tr>) element and I'd like to use jQuery to get the next table row that A) is visible, and B) does not have the attribute id='count-me-out'.

我想我可以循环执行此操作(尽管我有关于检查可见性的一些问题,无论用于控制可见性的属性如何)。但是我真正想要的是将一个选择器参数传递给 $(myTr).next()来实现这个过滤器。

I think I could do this in a loop (although I have some question about checking visibility regardless of what attributes are being used to control visibility). But what what I'd really like is to pass a selector argument to $(myTr).next() that would implement this filter.

这可能吗?

推荐答案

http://jsbin.com/apaxev/1/edit

var lookingFor = $(this).nextAll('tr:visible').not('#count-me-out').first();

或者喜欢:

var lookingFor = $(this).nextAll( 'tr:visible:not("#count-me-out"):first ');

这篇关于获取可见且没有属性的下一个元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆