I want to select all <a>
s but those have parents .x
I've tried
$(":not(.x)").find("a")
but realized you need a selector before :not
for it to work.
How can you select those? Please help!
您可以选择所有元素,然后排除.xa
元素,例如
$("a").not(".x a")
You do something like this:
$('a').each(function(){
if ($(this).parent().hasClass('x')){
// Do Something
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.