justyy
justyy

Reputation: 6041

Jquery selector - multiple classes/nested level?

How do I select the following in JQuery?

<div class='A'>
  <span class='B C'>
     <p class='C D E'>
     </p>
  </span>
</div>

The following isn't working.

$('div.A > span.B.C > p.C.D.E')

Upvotes: 0

Views: 3624

Answers (1)

J. Titus
J. Titus

Reputation: 9690

You could do $('.A').find('p.C')

https://api.jquery.com/find/

.find() : Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.

Upvotes: 1

Related Questions