jquery notes: The connection and difference between jquery and JavaScript

Source: Internet
Author: User
Tags jquery library

Source: http://www.ido321.com/1019.html

Ps:lz think this title is a bit big, beyond the scope of ability, do not like to touch. Currently only recorded in the LZ capacity within the range, and continue to supplement in the future.

One, the mutual transformation of jquery objects and Dom objects ("sharp jquery")

jquery into the DOM:

1, var JQ = $ (' #selector '); var dom = Jq[index];

2, var jq1 = $ (' #selector1 '); var dom1 = jq1.get (index) or var dom1 = Jq1.get () [index];

Dom translates to jquery:

Assuming that CR is a DOM object, convert to JQUERY,JQCR = $ (' cr ');

Two, jquery's $ (document). The difference between ready () and JavaScript's window.onload ("Sharp jquery")

1. Timing of implementation

Window.onload must wait for all resources (including pictures) in the Web page to be loaded before they can be executed, and $ (document). Ready () executes after all DOM structures have been drawn, but the resources that may be associated with the DOM have not yet been loaded.

2, write the number

In a document, Window.onload is only one, while $ (document). Ready () can have multiple

3. Simplified method

Window.onload no shorthand form, $ (document). Ready () can be abbreviated to $ (function () {}).


Third, the difference between the names of access attributes in jquery and JavaScript ("jquery Combat")

jquery Specification Name DOM Specification

CellSpacing cellspacing

Class ClassName

colspan colspan

Cssfloat IE is stylefloat, other browsers are cssfloat

Float IE is stylefloat, other browsers are cssfloat

For htmlfor

Frameborder frameborder

MaxLength MaxLength

ReadOnly ReadOnly

RowSpan rowspan

Stylefloat IE is stylefloat, other browsers are cssfloat

TabIndex TabIndex

Usemap Usemap

Iv. conflict

Dom does not theoretically conflict, and jquery prevents conflicts from two solutions: ("sharp jquery")

1. The jquery library is imported after other libraries

Call jquery. The Noconflict () method uses the control to another library, or a custom shortcut, $j = Jquery.noconflict ();

2. The jquery library is imported before other libraries

Use jquery directly instead of working, while $ can be used as a shortcut to other libraries.

Next article: MySQL extension for php: MySQL database overview


jquery notes: The connection and difference between jquery and JavaScript

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.