1. Base Selector
ID Selector: $ ("#id"), style selector: $ (". ClassName"), Element selector: $ ("div"), $ ("*") Select all elements of the page
Use both selectors for example: ID and element $ ("#id, div"), where you can add more for example plus a style of $ ("#id, Div,.classname");
2. Property Selector
$ ("Div[title]") Select the div element containing the title, $ ("Div[title]") Select the div element containing the title=test $ ("div[title=test]"); Select the div element with the Title property not equal to test: $ ("div[title!=test]"), which will select the div without the title attribute.
Select the div element that begins with the title TE: $ ("div[title^=te]"), select the div element with title ending in est: $ ("div[title$=est]"), and select the title attribute that contains the div element for es: $ ("div[ Title*=es] ")
Multi-Selector Composite use: Select the hidden field, the property containing the title of the Div,id is one,class as one element $ ("Input[type=hidden],div[title, #one,. One]"), so that the object result is a set.
3. Hierarchy Selector
A. Select all the DIV elements under the body
$ ("body div"); Note that this selects all descendant elements under the body, such as any other div in the div that is also selected.
B. Select the sub div under body
$ ("Body>div"); Note that the direct child element of the selected body, that is, the selection does not include the grandchild element Div, the difference is that the angle brackets are added to remove the space.
C. Select the input element next to the Laber element,
$ ("laber+input"); note that when this is selected, two input elements are selected if there are two laber elements in HTLM, and the input element is followed by two laber elements.
D. Selection and all sibling elements behind the form element sibling
$ ("Form~div"), so you select all the DIV elements that follow the same level as the form element.
E. Select all div elements of the same level as the element with ID test
$ ("#test"). Parent (). Children ("div"); Note: First get the element's parent element and then get all the child elements of that element in the DIV element.
Basic knowledge of jquery review (base selector, attribute selector, hierarchy selector)