KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I know this has been asked numerous times, and I have tried all the suggestions, and read all about varying selectors, and etc. but nothing is working for me given the following piece of HTML: <div class="class1"> <p> <a>link</a> </p> <div class="class2 class3"> <p> <font> <a>link2</a> </font> </p> </div> </div> I want to select the first div's <a> tag, but nothing from the second div I have tried: $('.class1').not('.class2, .class3') $('.class1').not('.class2') $('.class1').not('.class3') $(".class1:not(.class2)") $(".class1:not(.class3)") $(".class1:not(.class2, .class3)") $("div.class1:not(.class2)") $("div.class1:not(div.class2)") $("div.class1:not(div.*)") etc. I don't know if it's because the second div has two class names, or because the second div's <a> tags are not direct children of the second div (e.g. there are font tags and such around them) but I am unable to exclude the second div.
Tags (comma-separated)
Save Edits
Cancel