jquery usage and selectors

Source: Internet
Author: User

1. Advantages

(1) can solve the browser compatibility JS problem

(2) solve the problem of JS code redundancy

(3) animation effect easier to implement

2, compression and non-compression of the difference

(1) In the development process with uncompressed, on-line after the use of compressed version.

(2) version issue: 1. XXX compatible IE678

2.XXX not supported IE678

and jquery dedicated to mobile development.

3, two kinds of entry function mode

(1) $ (document). Ready (function () {


(2) $ (function () {


(3) JS can not have two entry function, because the back will cover the front. But the jquery entry function will not be overwritten, and two entry functions will execute.

(4) Entrance function difference:

The entry function of JS is to wait until all the contents of the page are loaded before going back to execution.

The entry function of jquery is to wait until all the tabs of the page have been loaded before going back to execution.

4. Detailed use of jquery

jquery takes up $ and jquery two variables, at first using jquery, but later finds trouble, so it uses $ instead of jquery.

jquery's $ sign is already occupied, so JS can use the $ symbol as the variable name or function name, but not in jquery.

5, CSS in the detailed use of jquery

(1) Setting style

$ ("Picker name"). CSS (attribute list);

Example: $ ("selector name"). CSS ("Properties", "values"); set a style

$ ("selector name"). CSS ({"property": "Value", "Property": "Value"}), set multiple styles

To set a style by using a function: For selecting multiple selectors, you want to give them a few styling styles

$ ("selector name"). CSS ("Properties", function (Index,value) {

Index is the ordinal of the representative, plus an if judgment can be used to set the specific selector by index


(2) Get style

$ ("selector name"). CSS (attributes);

jquery usage and 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.