Use the selector to select the elements in the html to be operated.
1. Use the basic selector of CSS:
A: match all link elements.
# *: Match the element with id *
. *: Matches the element of the CSS class *.
A # * id. * class: matches the id as * id and has a link element with the CSS class as * class.
The above is the style in CSS, Which is wrapped in $ ("") in jQuery, such as jQuery ("p a. Class ")
Take the sub-selector, container selector, and feature selector as an example:
The Code is as follows:
- JQuery supports
- CSS1
- CSS2
- CSS3
- Basic XPath
-
- Custom selectors
- Form selectors
If you want to select the first list
The sub-Selector ul. myList> li> a should be used to perform operations on all links in. Instead, ul. myList li a cannot be like this because all these links are lists.
Child node of the element.
Child selector: the parent node and the direct child node are separated by Angle brackets (>.
Feature selector: Pack elements that match specific content. For example, select the link that contains the href value starting with http: //: a [href ^ = http: //]
Input [type = text]: matches allElement
P [title = ^ my]: matches all the title feature values starting with myElement.
Select by location
A: first: The selector matches the first element on the page.
P: odd, p: even match odd and even elements respectively.
I will not give you an example of others. If necessary, you can find them on the relevant website.