jquery System Learning Notes
First, primary knowledge:
The advantages of jquery:
1, lightweight (less than 30KB after compression)
2, powerful selector (support CSS1, CSS2 selector of the majority of all CSS3 and some of the original add-ons can also support XPath)
3. Excellent DOM encapsulation (simplifies the original complex operation)
4. Reliable event handling mechanism (cross-browser compatibility)
5. Perfect Ajax operation (a $.ajax () method is all done)
6, do not pollute the top-level variable (only use an object named jquery its alias $ can also be at any time to give up its control see resolution and other Library mix conflict Resolution section)
7. Excellent browser compatibility (one of the most essential conditions of JS Library)
8, chain operation (Point operation. End () method returns the previous pre-destructive jquery object)
9. Implicit iterations (methods in jquery are automatically designed to manipulate every DOM object in a JQuery object (DOM collection) without looping)
10. Separation of behavioral and structural layers (thanks to selectors like CSS)
11. Rich plugin Support (jquery extensibility has attracted developers from all over the world to write jquery plugins)
12. Perfect Documentation
13. Open Source
Ii. Selectors (the foundation of jquery)
(Supports Css1 css2 of all and CSS3 absolute parts as well as some peculiar ones)
Category: Basic selector, hierarchy selector, filter selector, and form selector (classification is easier to remember)
1. Basic Selector
#id
. className
Element
*
#id,. ClassName
2. Hierarchy Selector
$ ("ancestor descendant") descendant selector
$ ("parent>child") child element Selector
$ ("Prev+next") the next element immediately following prev is equivalent to the. Next ("selector") method
$ ("prev~siblings") the sibling element of all siblings after selecting Prev is equivalent to Nextall ()
Note: $ ("#prev"). Siblings ("selector") method selects all sibling elements of the #prev element
3. Filter selector (same as Pseudo-class selector method in CSS with a colon (:)
Filter selector: Also divided into basic filtering, content filtering, visibility filtering, attribute filtering, sub-element filtering, and form object property filtering
Basic Filtration:
: first selects the initial element such as $ ("Div:first") and selects the first one in all Div
: Last element selected
: Not (selector) removes all elements that match a given selector
: Even all elements with an even number selected index starting from 0: odd Odd line
: EQ (index) selects an element that is equal to index: The GT index is greater than index: LT (index) index is smaller than index
: Header selects all header elements such as H1~h6
: Animated Select the element that is currently performing the animation
Content Filter Selector:
: Contains (text) Select the element containing the text content as "text"
: Empty selects null elements that do not contain child elements or text (note: There are spaces or line breaks are not empty elements OH)
: Has (selector) Select "contains matching elements"
Sharp jquery Second Edition study notes