the selectors in Jquery fall into several categories: basic filter selector, hierarchy selector, Content filter selector, visibility filter selector, attribute filter selector, child element filter selector, form object selector and form object Zodiac filter selector.
1. Non-basic filter selectors, generally need to use with the basic filter selector.
2, from the performance of the original Soundtrack support ID selector, tag Selector, class selector performance is best, the other is generally through the DOM Loop lookup to get, therefore, allow the condition, the first Choice JS native support JS native selector.
3, it is best to provide the context of the selector to narrow the target element's lookup range.
First, the basic selector.
#id;. Class;element;*;selector1,selector2,... Selectorn (the elements that match each selector are merged and returned together)
Second, level selector
$ ("ancestor descendant"); select descendant elements;
$ ("Parent>child"); Select child elements;
$ ("selector"). Next (); Select the next sibling element immediately following it;
$ ("selector"). Nextall () all sibling elements after the selection;
$ ("selector"). Siblings () selects all sibling elements before and after;
$ ("selector"). Prev () Gets the previous sibling element
$ ("selector"). Parents () gets the ancestor element
$ ("selector"). Parent () gets the parents element
$ ("selector"). Closet () Gets the most recent matching ancestor element
After several levels of lookup functions, you can use selectors as function parameters
Three, basic filter selectors
: First;:last;:even;:o Dd;:eq (index);: GT (index);: LT (index); Select according to the subscript of the same class of elements
: Not (selector);: Header;:animated;:focus::p arent; Select according to the state of the element
Iv. Content Filter Selector
: Empty;:contains (key);
: Has (Seletor) elements that conform to a selector feature
: Find (Seletor) a descendant element that conforms to a selector feature
: Filter (Seltor) a sibling element that conforms to a selector feature
V: Visibility Filter Selector
: hidden;:visible
Vi. Attribute Filter Selector
[attribute]; [Attribute=value]; [Attribute!=value]; [Attribute^=value]; [Attribute$=value]; [Attribute*=value]; [Attribute|=value]; [Attribute~=value]; [Attribute1] [Attribute2] ... [Attributen]
Seven: child element filter Selector
: Nth-child (index/even/odd);: First-child;last-child;:o Nly-child;
Eight: Form element selector
: Input;:text;:p assword;:radio;:checkbox;:submit;:image;:reset;:button;:file;
IX: Form element attribute filter Selector
: Enabled;:d isabled;:checked;:selected;
The three---jquery selector for front-end learning