Here ya go: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en" dir="ltr"> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ ajax/libs/jquery/1.3/jquery.min.js"> </script> <script type="text/javascript">
$(function(){ var preBefore = $('p:eq(3)').prev('pre').text(); var preAllAfter = ""; $('p:eq(3)').nextAll('pre').each(function(){ preAllAfter += $(this).text()+'\n'; }); console.log( preBefore ); console.log( preAllAfter ); }); </script> </head> <body> <pre>loreum ipsum 1</pre> <p>paragraph 1</p> <pre>loreum ipsum 2</pre> <p>paragraph 2</p> <pre>loreum ipsum 3</pre> <p>paragraph 3</p> <pre>loreum ipsum 4</pre> <p>paragraph 4</p> <pre>loreum ipsum 5</pre> <p>paragraph 5</p> <pre>loreum ipsum 6</pre> <p>paragraph 6</p> <pre>loreum ipsum 7</pre> <p>paragraph 7</p> <pre>loreum ipsum 8</pre> <p>paragraph 8</p> </body> </html> On Jan 19, 1:59 pm, JLundell <jlund...@pobox.com> wrote: > I have a page with alternating sets of one or more <p> and <pre> > paragraphs. > > Given that $(this) is a <p> block, I want to select the next <pre> > block, plus the additional <pre> blocks, if any, that follow the first > one. > > How?