Is there a way for me to add the next several blocks until I get to a
specific tag?

So let's say the code is:

<h5>title</h5>
<p>description text</p>
<p>description text</p>

<h5>title2</h5>
<p>description text</p>
<p>description text</p>
<p>description text</p>

<h5>title2</h5>
<p>description text</p>


Basically, I want to select all the <p> tags until I get to the <h5>.
There might be 1 <p> tag, there might be 10 of them, but I want to
traverse this structure to add all <p> tags.

Right now, I'm doing this to select 1 of the <p> tags:

        $('h5').each(function(){
                var $this = $(this);
                $this
                        .add($this.next());
        });

Reply via email to