3

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

2 Answers 2

8

Use .find():

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

(The documentation is your friend :))

1
  • 1
    or $(e).children('.foo'), depending on what you want (the title and the description of the OP are inconsistent)
    – Amadan
    Mar 28, 2011 at 2:07
-2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.