jquery Memory Consolidation

Source: Internet
Author: User

jquery is written by the native JS so that all jquery produced by the effect can be used JS to make, the purpose of jquery is to optimize the code, improve code code efficiency it will be many functions encapsulated.

I. The understanding of jquery

1. What is jquery

The 1 jquery, created by American John Resig, has attracted many JavaScript gurus from around the world to join their team. 2 jquery is another excellent JavaScript framework following prototype. Its purpose is--write Less,do more!3 It is a lightweight JS library (only 21k after compression), this is not the other JS library, it is compatible with CSS3, also compatible with a variety of browsers 4 jquery is a fast, concise JavaScript library, Make it easier for users to handle htmldocuments, events, animate, and easily provide Ajax interactivity to your site. 5 jquery There is also a big advantage is that its documentation is very full, and a variety of applications are described in detail, while there are many mature plug-ins to choose from.

2. Advantages

Short, lean, easy to write, save things, high development efficiency

3, JS and jquery relationship

jquery was written by JS.

JS is the foundation, jquery is the tool

4. Introduction to jquery
1) version
1.x compatible IE8 ...
3.x Latest
2). Min.js Compression for production environments
3). JS is not compressed for development use

5, download is used

1) Download: https://jquery.com/

2) Import jquery: <script src= "Jquery-3.2.1.js" ></script>

3) Use: Jquery.xxxxx--$ (). xxx

Ii. jquery Objects

1. jquery Object

The jquery object is the object that is generated after wrapping the DOM object through jquery. jquery objects are unique to jquery. If an object is a jquery object, then it can use the method in jquery

Simply put:

The jquery selector is the jquery object.

2. jquery Objects and Dom objects

jquery object, it can only use the JQuery method, cannot use the DOM method, the DOM object also cannot use the jquery method

3. The conversion of JQuery objects and Dom objects

1) JQuery Object goto DOM Object

jquery Object [0]--$ (". C1") [0]

2) Dom object to jquery Object

$ (DOM object)

4. Basic grammar

$ (selector). Action ()

Iii. Selectors and filters

1. Selector

1) Basic Selector

-ID Selector        $ ("#id")-          class Selector $ ("        . Class")-Tag Selector $ ("      element")-All tags        $ ("*")-Combo selector      $ ("#id,. Class")

2) Level Selector

-From a tagged descendants to find $ ("    father Descendants") $ ("                      #id a")            -Find $ ("Father > Son tag") from within a tagged son ("                     #id >a")  - Find the label next to            $ ("label + next to the label below")            $ ("#id +a")-Find all the siblings behind $ ("           label ~ Brother Tag")                     $ ("#id ~a")

3) Property Selector

Find        $ ("input[type= ' Text") by property

2. Filter

1) Base Filter

$ (": First")    gets the initial element $ (": Not (')") to   remove all elements matching the given selector $ (": even")   match all index values to an even number of elements         $ (": odd")    Match all index values to an odd element $ (": eq") to match the element    of a given index value $ (": GT") to    match all elements greater than the given index value $ (": Last") to    get the final element $ (": Focus")    Matches the element that currently acquires focus.

2) Content

$ (": Contains") matches the    element containing the given text $ (": Empty")    matches all empty elements that do not contain child elements or text $ (": Has (')")    matches the element that contains the element that the selector matches (": Parent ")    matches elements that contain child elements or text

3) Visibility

$ (": Hidden)    matches all invisible elements, or type is hidden element $ (": visible ")    matches all visible elements

4) Form

View Code

5) Form Properties

: Enable    matches all available elements: Disable    matches all unavailable elements: Checked matches all selected selected    elements: Selected    matches all selected option elements

3, the method of the form of screening

1) Filter

$ (""). EQ ()    Gets the current chained operation in the nth jquery object $ (""). First ()    gets the initial element $ (""). Last ()    gets the final element $ (""). Hasclass ()    Checks whether the current element contains a particular class, and if so, returns true$ (""). has ()    retains the element that contains the specific descendant $ (""). Not ()    removes the element that matches the specified expression from the collection of matching elements $ (""). Slice ( Start,end)    pick a matching subset

2) Find

$ (""). Children ()    the element collection ("") for all child elements. Find ()    searches all elements that match the specified expression. $ (""). Next ()    gets after a sibling element of $ (""). Nextall ()    gets all the sibling elements after. $ (""). Nextuntil ()    finds all sibling elements after the current element until a matching element is encountered. $ (""). OffsetParent ()    returns the parent node that the first matching element is used for positioning. $ (""). Parent ()    gets a collection of elements that contain a unique parent element for all matching elements. $ (""). Parents ()    gets a collection of elements (without root elements) that contains the ancestor elements of all matching elements. You can filter by an optional expression. $ (""). Parentsuntil ()    finds all the parent elements of the current element until the matching element is encountered. $ (""). Prev ()    Gets the previous sibling element. $ (""). Prevall ()     gets all the previous sibling elements. $ (""). Prevuntil ()    finds all sibling elements before the current element until a matching element is encountered. $ (""). Siblings ()    gets a collection of elements that contain all the unique sibling elements of each element in the matching element collection.

JQuery Memory Consolidation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.