What is jquery $ jquery object and Dom object and some selectors

Source: Internet
Author: User

1 What is jquery:

jquery is to encapsulate some methods in a JS file. It's a JS library.

We learn these methods.

2 Why to learn jquery:

Native JS has the following issues:

1. Compatibility issues
2. Code duplication
The method name provided by 3.DOM is too long and difficult to remember
4. Poor code tolerance
5. The entry function can only have one, if there are multiple, the back will overwrite the front

3

jquery Version Description:
Large version; 1 2 3 1 compatible IE6, 7, 8 2 3 incompatible
Small version: Compressed version (used in production) No comment No line break no space variable name is a B c D This mode is particularly small
Uncompressed version (used in development environment) Notes are especially clear and clear format

4$ Essence

$ (selector) Selector
$ (domobj) Convert DOM objects to jquery objects
The second notation of the $ (function) entry function

$===jquery

5jQuery objects and Dom objects:

jquery object: The jquery method gets the element that is the jquery object

The jquery object is the wrapper set (pseudo-array) of the DOM object

Dom object: The element that the JS method gets is the DOM object


jquery Object Goto DOM Object
Jqueryobj[index]
Jqueryobj.get (Index)

Dom object to jquery object (Money will do)
$ (domobj)

5 Some selectors::

5.1 Basic selector: ID selector $ ("#id名")

Class Selector $ (". ClassName")

TAB selection period $ ("TagName")

and the set selector $ ("Selector1,slector2 ...")

Intersection selector $ ("Selector1selector2 ...")

5.2 Level Selector

Descendant selector $ ("Selector1 selector2 ....")
Descendant Selection period $ ("SELCTOR1>SELECTOR2> ...")

5.3 Filter Selector
$ ("Selector:filter")
$ ("selector:odd") odd filter Selector
$ ("Selector:even") even filter selector
$ ("Selector:eq (Index)") Ordinal filter Selector

5.4 Filter Selector
Is the method
Jequryobj.children ("selector") sub-element filtering
Jequryobj.parent () parent element
Jequryobj.siblings ("selector") sibling element filter
Jequryobj.next (); next element
Jequryobj.find ("selector") descendants filter
JEQURYOBJ.EQ (index) Number filter

What is jquery $ jquery object and Dom object and some selectors

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.