- Get Started
- 基础
- 进阶
- 技巧
- 插件推荐
- API
- Get Started
- 基础 API
- QueryList html($html)
- string getHtml($rel = true)
- QueryList rules(array $rules)
- QueryList range($selector)
- QueryList removeHead()
- QueryList query(Closure $callback = null)
- Collection getData(Closure $callback = null)
- Array queryData(Closure $callback = null)
- QueryList static getInstance()
- void destruct()
- void destructDocuments() 静态方法
- QueryList pipe(Closure $callback)
- 特殊 API
- 高级 API
- 默认插件
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
phpQuery 选择器
下面选择器规则完全适用于QueryList 。
- Basics
- Hierarchy
- Basic Filters
- Content Filters
- Visibility Filters
- Attribute Filters
- Child Filters
- Forms
- Form Filters
Selectors are the heart of jQuery-like interface. Most of CSS Level 3 syntax is implemented (in state same as in jQuery).
Example
pq(".class ul > li[rel='foo']:first:has(a)")->appendTo('.append-target-wrapper div')->...
Basics
- #id Matches a single element with the given id attribute.
- element Matches all elements with the given name.
- .class Matches all elements with the given class.
- * Matches all elements.
- selector1, selector2, selectorN Matches the combined results of all the specified selectors.
Hierarchy
- ancestor descendant Matches all descendant elements specified by "descendant" of elements specified by "ancestor".
- parent > child Matches all child elements specified by "child" of elements specified by "parent".
- prev + next Matches all next elements specified by "next" that are next to elements specified by "prev".
- prev ~ siblings Matches all sibling elements after the "prev" element that match the filtering "siblings" selector.
Basic Filters
- :first Matches the first selected element.
- :last Matches the last selected element.
- :not(selector) Filters out all elements matching the given selector.
- :even Matches even elements, zero-indexed.
- :odd Matches odd elements, zero-indexed.
- :eq(index) Matches a single element by its index.
- :gt(index) Matches all elements with an index above the given one.
- :lt(index) Matches all elements with an index below the given one.
- :header Matches all elements that are headers, like h1, h2, h3 and so on.
- :animated Matches all elements that are currently being animated.
Content Filters
- :contains(text) Matches elements which contain the given text.
- :empty Matches all elements that have no children (including text nodes).
- :has(selector) Matches elements which contain at least one element that matches the specified selector.
- :parent Matches all elements that are parents - they have child elements, including text.
Visibility Filters
none
Attribute Filters
- [attribute] Matches elements that have the specified attribute.
- [attribute=value] Matches elements that have the specified attribute with a certain value.
- [attribute!=value] Matches elements that don't have the specified attribute with a certain value.
- [attribute^=value] Matches elements that have the specified attribute and it starts with a certain value.
- [attribute$=value] Matches elements that have the specified attribute and it ends with a certain value.
- [attribute*=value] Matches elements that have the specified attribute and it contains a certain value.
- [selector1selector2selectorN] Matches elements that have the specified attribute and it contains a certain value.
Child Filters
- :nth-child(index/even/odd/equation) Matches all elements that are the nth-child of their parent or that are the parent's even or odd children.
- :first-child Matches all elements that are the first child of their parent.
- :last-child Matches all elements that are the last child of their parent.
- :only-child Matches all elements that are the only child of their parent.
Forms
- :input Matches all input, textarea, select and button elements.
- :text Matches all input elements of type text.
- :password Matches all input elements of type password.
- :radio Matches all input elements of type radio.
- :checkbox Matches all input elements of type checkbox.
- :submit Matches all input elements of type submit.
- :image Matches all input elements of type image.
- :reset Matches all input elements of type reset.
- :button Matches all button elements and input elements of type button.
- :file Matches all input elements of type file.
- :hidden Matches all elements that are hidden, or input elements of type "hidden".
Form Filters
- :enabled Matches all elements that are enabled.
- :disabled Matches all elements that are disabled.
- :checked Matches all elements that are checked.
- :selected Matches all elements that are selected.
Read more at Selectors section on jQuery Documentation Site.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论