user1708560
user1708560

Reputation:

How to select a nested element

In this HTML:

<div class="seal">
    <div class="how with"> </div>
    <div class="how"> </div>
    <div class="with"> </div>
</div>

How can I select this nested element?:

<div class="how with"> </div>

Upvotes: 2

Views: 161

Answers (2)

yasaricli
yasaricli

Reputation: 2533

<div class="seal">

    <div class="how with"> </div>
    <div class="how"> </div>
    <div class="with"> </div>
</div>

selector .seal:

var seal = jQuery(".seal");

selector .how

jQuery(".how", seal);

selector .with

jQuery(".with", seal);

selector .how and .with

jQuery(".how.with", seal);

or

jQuery(".seal .how.with");

Upvotes: 1

Ram
Ram

Reputation: 144689

jQuery selectors work like CSS selectors:

$('.seal .how.with')

Upvotes: 1

Related Questions