Query InsertAfter - ThomasWeinert/FluentDOM GitHub Wiki
FluentDOM\Query insertAfter(string|array|\DOMNode|\Traversable $selector);
Insert all of the matched elements after another, specified, set of elements.
$html = <<<HTML
<html>
<head>
<title>Examples: FluentDOM\Query::insertAfter()</title>
</head>
<body>
<p> is what I said... </p><div id="foo">FOO!</div>
</body>
</html>
HTML;
echo FluentDOM($html)
->find('//p')
->insertAfter('//div[@id = "foo"]');
<?xml version="1.0"?>
<html>
<head>
<title>Examples: FluentDOM\Query::insertAfter()</title>
</head>
<body>
<div id="foo">FOO!</div><p> is what I said... </p>
</body>
</html>