Common CSS selector syntax of the dojo. Query () method
Syntax |
Meaning {http://didi.cnblogs.com} |
Example |
* |
Any element |
Dojo. Query ("*") |
E |
Elements labeled as E |
Dojo. Query ("Div ") |
. C |
Elements with Class C |
Dojo. Query (". Baz ") |
E. c |
Elements labeled as E with Class C |
Dojo. Query ("Div. Baz ") |
# ID |
Element whose ID value is ID |
Dojo. Query ("# quux ") |
E # ID |
Element with Label E and ID value ID |
Dojo. Query ("span # quux ") |
[A] |
Element with attribute |
Dojo. Query ("[Foo]") |
E [A] |
Element with attribute a and Label E |
Dojo. Query ("span [Foo]") |
[A = "v"] |
Element with a property A and its value is V |
Dojo. Query ("[Foo = 'bar']") |
E [~ = 'V'] |
The label is E and has attribute a, and the attribute value is a list separated by spaces. At the same time, an element whose value is exactly equal to V |
Dojo. Query ("span [Foo ~ = 'Bar'] ") |
E [A ^ = 'V'] |
Element whose label is E and has attribute a and whose attribute value starts with V |
Dojo. Query ("span [Foo ^ = 'bar']") |
E [A $ = 'V'] |
Element whose label is E and has attribute a and whose attribute value ends with V |
Dojo. Query ("span [Foo $ = 'bar']") |
E [A * = 'V'] |
The label is E with attribute a, and the attribute value contains the element of the sub-string v. |
Dojo. Query ("span [Foo * = 'bar']") |
E> F |
F element as Element E sub-element |
Dojo. Query ("div> span ") |
E F |
F element as the descendant element of Element E |
Dojo. Query ("e f ") |
I sorted it out. It should be helpful for some beginners.