开发者

jQuery - selecting every .class member except the parent of $(this)

开发者 https://www.devze.com 2023-01-23 22:04 出处:网络
how do I select every class mem开发者_Python百科ber except the one that is the parent of $(this)?How about:

how do I select every class mem开发者_Python百科ber except the one that is the parent of $(this)?


How about:

$(".your-class").not($(this).parent())


Try this:

$('.myClass').not(this.parentNode);

This will have significantly better performance than using $(this).parent(), because it doesn't involve creating a new jQuery object.

0

精彩评论

暂无评论...
验证码 换一张
取 消