Skip to content
Thomas Weinert edited this page Jul 30, 2014 · 1 revision

FluentDOM\Query::nextAll()

FluentDOM\Query nextAll([ string $selector = NULL ])

Find all sibling elements after the current element.

Usage

$html = <<<HTML
<html>
  <head>
    <title>Examples: FluentDOM\Query::nextAll()</title>
  </head>
  <body>
    <div>first</div>
    <div>sibling<div>child</div></div>
    <div>sibling</div>
    <div>sibling</div>
  </body>
</html>
HTML;

echo FluentDOM($html)
  ->find('//div[position() = 1]')
  ->nextAll()
  ->addClass('after');

Output

<?xml version="1.0"?>
<html>
  <head>
    <title>Examples: FluentDOM\Query::nextAll()</title>
  </head>
  <body>
    <div>first</div>
    <div class="after">sibling<div>child</div></div>
    <div class="after">sibling</div>
    <div class="after">sibling</div>
  </body>
</html>
Clone this wiki locally