forked from TobiaszCudnik/phpquery
-
Notifications
You must be signed in to change notification settings - Fork 66
Traversing
didier Belot edited this page Mar 6, 2018
·
2 revisions
pq('div > p')->add('div > ul')
->filter(':has(a)')
->find('p:first')
->nextAll()
->andSelf()->...
- eq($index) Reduce the set of matched elements to a single element.
- hasClass($class) Checks the current selection against a class and returns true, if at least one element of the selection has the given class.
- filter($expr) Removes all elements from the set of matched elements that do not match the specified expression(s).
- filter($fn) Removes all elements from the set of matched elements that does not match the specified function.
- is($expr) Checks the current selection against an expression and returns true, if at least one element of the selection fits the given expression.
- map($callback) Translate a set of elements in the jQuery object into another set of values in an array (which may, or may not, be elements).
- not($expr) Removes elements matching the specified expression from the set of matched elements.
- slice($start, $end) Selects a subset of the matched elements.
- add($expr) Adds more elements, matched by the given expression, to the set of matched elements.
- children($expr) Get a set of elements containing all of the unique immediate children of each of the matched set of elements.
- contents() Find all the child nodes inside the matched elements (including text nodes), or the content document, if the element is an iframe.
- find($expr) Searches for all elements that match the specified expression. This method is a good way to find additional descendant elements with which to process.
- next($expr) Get a set of elements containing the unique next siblings of each of the given set of elements.
- nextAll($expr) Find all sibling elements after the current element.
- parent($expr) Get a set of elements containing the unique parents of the matched set of elements.
- parents($expr) Get a set of elements containing the unique ancestors of the matched set of elements (except for the root element). The matched elements can be filtered with an optional expression.
- prev($expr) Get a set of elements containing the unique previous siblings of each of the matched set of elements.
- prevAll($expr) Find all sibling elements before the current element.
- siblings($expr) Get a set of elements containing all of the unique siblings of each of the matched set of elements. Can be filtered with an optional expressions.
- andSelf() Add the previous selection to the current selection.
- end() Revert the most recent 'destructive' operation, changing the set of matched elements to its previous state (right before the destructive operation).
Read more at Traversing section on jQuery Documentation Site.