morpheus
morpheus

Reputation: 20350

JQuery: How can I select all descendant nodes of an element that have a certain css class on them?

Given a DOM element e, I would like to select all descendants that have class='foo'. How can I do this in jquery?

Upvotes: 3

Views: 3339

Answers (2)

Annamacharya
Annamacharya

Reputation: 1

You can use some thing like $(this).childrens().hasClass('foo'), I will try to give the exact answer, if I know the exact query.. please try to be more precise in your question.

Upvotes: -2

Felix Kling
Felix Kling

Reputation: 816472

Use .find():

$(e).find('.foo')

(The documentation is your friend :))

Upvotes: 8

Related Questions