jamesfzhang
jamesfzhang

Reputation: 4473

Selecting a tag and class (jQuery)

Say I the following:

<div id = "thisOne">
<a href = "#" class="ui-state-highlight">abc</a>
<a href = "#'>def</a>
</div>

If i do $(".thisOne a") I get both "a" elements. I just want the one that is highlighted, how do I do this?

Upvotes: 0

Views: 258

Answers (2)

rlemon
rlemon

Reputation: 17666

This two lines of code should help you, give them a try :

$("#thisOne .highlight")

and for the other

$("#thisOne :not(.highlight)")

Upvotes: 4

Jack
Jack

Reputation: 8941

This should do it: $('a.highlight');

Upvotes: 0

Related Questions