与.find()相反 [英] Opposite of .find()

查看:92
本文介绍了与.find()相反的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.find()是否相反?

Is there an opposite of .find()?

$('.myclass').except('#myid');

除了带有#myid的元素外,都将使用.myclass的所有元素. 我知道我可以在此示例中执行$('.myclass[id=myid]'),但在其他情况下似乎会有所帮助.

Would grab all elements with .myclass except the element with #myid. I know I could do $('.myclass[id=myid]') in this example, but seems like it would be helpful in other cases.

谢谢

感谢您的答复!好像我只是错过了在文档中看到.not():not()一样.

Thanks for the responses! Looks like I just missed seeing .not() and :not() in the documentation.

推荐答案

$('.myclass').not('#myid');

http://api.jquery.com/not/

这篇关于与.find()相反的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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