Recently, I am working on a Youtube comment loader project, and I want to select the first <p>
element after <a>
element in this example:
<p></p>
<a id="this_is_the_a_element">
<p></p>
</a>
<pre></pre> <!-- More random elements here -->
<p id="first_p_after_a"></p>
<p id="second_p_after_a"></p>
<p id="third_p_after_a"></p>
I know I can using substring to achieve that, but is there a more efficient way (just like querySelector
) to do that?
Also, how could I select the second, third, and so on element after a specific element?