-
Notifications
You must be signed in to change notification settings - Fork 20
Query Prev
Thomas Weinert edited this page Jul 31, 2014
·
1 revision
FluentDOM\Query prev([ string $selector = NULL ])
Get a set of elements containing the unique previous siblings of each of the matched set of elements.
$html = <<<HTML
<html>
<head>
<title>Examples: FluentDOM\Query::prev()</title>
</head>
<body>
<div><span>has child</span></div>
<div id="start"> </div>
<div> </div>
<div><span>has child</span></div>
<div class="here"><span>has child</span></div>
<div><span>has child</span></div>
<div class="here"> </div>
<div> </div>
<p><button>Go to Prev</button></p>
</body>
</html>
HTML;
echo FluentDOM($html)
->find('//div[@id = "start"]')
->prev()
->addClass('before');
<?xml version="1.0"?>
<html>
<head>
<title>Examples: FluentDOM\Query::prev()</title>
</head>
<body>
<div class="before"><span>has child</span></div>
<div id="start"> </div>
<div> </div>
<div><span>has child</span></div>
<div class="here"><span>has child</span></div>
<div><span>has child</span></div>
<div class="here"> </div>
<div> </div>
<p><button>Go to Prev</button></p>
</body>
</html>
- Home
- Getting Started
- Tasks
- Plugins
- Functions
- Lists
- Creator (5.1)
- CSS Selectors
- Convertors
- Loaders
- Serializers (5.1)
- Transformers (5.1)
- Extended DOM
- XMLReader (6.1)
- XMLWriter (6.1)
- Interfaces