Selecting <p> within a div using jQuery
javascript, jquery
Solution
You can do this way:
$('.itemize > div > p:eq(0)')
`.itemize > div` goes till:
<div class="itemize">
<p> Order Summery</p>
</div>
And
`.itemize > div > p:eq(0)`
<div class="itemize">
<p> Order Summery</p>
<div>
<p><strong>Packages:</strong> </p>
</div>
</div>
The `>` allows to target direct children whereas `eq(index)` is used to get first `p` that you want.
Problem
I want to select the second `<p>` tag and style it within a `itemize` class div. Here is the example HTML: ``` <div class="itemize"> <p> Order Summery</p> <div> <p><strong>Packages:</strong> </p> <!-- i want to select this P tag--> <p><strong>Date:</strong> </p> <p><strong>Style:</strong> </p> </div> </div> ``` I want to select and style the first `<p>` which is immediately after the second `<div>`. The second `<p>` has no ID or class. How can I select it via jQuery?