For the 2nd <h3>World!</h3> in this sample scenario (Please note <..> elements are unknown elements at all levels):
<div></div>
<div class="class1">
<..>
<h3>Hello!</h3>
<..>
<h3>World!</h3>
</..>
</..>
</div>
Lets assume we know only:
Top Parent <div class="class1">andTarget Child Elements <h3>- Middle levels are
unknowns. Can be<p>or<div>or<ul>whatever.
So I want to use nth-child(n) selector. But I can’t use like this:
$("div.class1 h3:nth-child(2)").html();
Now i’m realized is the nth-child(n) selector can select only the Direct Child of the parent element, rite?
Can i make it work by using nth-child(n) selector?
Select all
h3‘s underdiv.class1depth first, and then take the second one.