find (
string $selector
[, int $idx = null ]
[, bool $lowercase = false ]
) : mixed
| Parameter | Description |
|---|---|
selector |
CSS selector. |
idx |
Index of element to return. |
lowercase |
Matches tag names case insensitive (lowercase) if enabled. |
Finds one or more nodes in the current document, using CSS selectors.
- Returns null if no match was found.
- Returns an array of
HtmlNodeif$idxis null. - Returns an object of type
HtmlNodeif$idxis anything but null.
Supported Selectors
| Selector | Description |
|---|---|
* |
Universal selector |
E |
Type (tag name) selector |
E#id |
ID selector |
E.class |
Class selector |
E[attr] |
Attribute selector |
E[attr="value"] |
Attribute selector |
E[attr="value"] i |
Case-sensitivity |
E[attr="value"] s |
Case-sensitivity |
E[attr~="value"] |
Attribute selector |
E[attr^="value"] |
Substring matching attribute selector |
E[attr$="value"] |
Substring matching attribute selector |
E[attr*="value"] |
Substring matching attribute selector |
E[attr|="value"] |
Attribute selector |
E F |
Descendant combinator |
E > F |
Child combinator |
E + F |
Next-sibling combinator |
E ~ F |
Subsequent-sibling combinator |
E, F |
Selector list |
E:not(s) |
Negation pseudo-class |