TIMEX
TIMEX

Reputation: 271824

How do I "find" in Jquery?

$("#start").find(divs where class=desc).show()

<div id="start">
<div class="desc" style="display:none;">I am visible.</div>
</div>

How do I do that?

Upvotes: 1

Views: 124

Answers (3)

Francisco Soto
Francisco Soto

Reputation: 10392

$("#start.desc").show();

Visit http://jsfiddle.net/9cg8D/ for the working example.

Upvotes: -2

Justin Ethier
Justin Ethier

Reputation: 134177

Try:

$("#start").find("div.desc").show()

Upvotes: 1

Andy E
Andy E

Reputation: 344575

Just like the jQuery() function, find() takes a CSS selector as an argument.

$("#start").find("div.desc").show();

find is the equivalent of context searching, so the above is the same as:

$("div.desc", "#start").show();

http://api.jquery.com/find/

Upvotes: 8

Related Questions