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

FluentDOM\Query::next()

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

Get a set of elements containing the unique next siblings of each of the given set of elements.

Usage

$html = <<<HTML
<html>
  <head>
    <title>Examples: FluentDOM\Query::next()</title>
  </head>
  <body>
    <div>
      <button disabled="disabled">First</button> <b>-</b> <span> </span></div>
    <div><button>Second</button> - <span> </span></div>
    <div><button disabled="disabled">Third</button> - <span> </span></div>
  </body>
</html>
HTML;

echo FluentDOM($html)
  ->find('//button[@disabled]')
  ->next()
  ->next()
  ->text('This button is disabled.');

Output

<?xml version="1.0"?>
<html>
  <head>
    <title>Examples: FluentDOM\Query::next()</title>
  </head>
  <body>
    <div>
      <button disabled="disabled">First</button> <b>-</b> <span>This button is disabled.</span></div>
    <div><button>Second</button> - <span> </span></div>
    <div><button disabled="disabled">Third</button> - <span>This button is disabled.</span></div>
  </body>
</html>
Clone this wiki locally