How to Write high-quality jQuery code (using jquery performance issues) _ jquery-js tutorial

Source: Internet
Author: User
As we all know, jQuery is now very popular, and jQuery has already been used on Baidu's new homepage. Today we will summarize how to write better jQuery code to make jQuery Code better and faster to execute, I hope this jQuery tutorial will change your previous unreasonable practices.

1. Correctly reference jQuery

1. Try to introduce jQuery before the body ends, rather than in the head.
2. Use a third-party CDN to introduce jQuery. Note that when a problem occurs with a third-party CDN, you must introduce a local jQuery file. (For websites that have already used cdn, you can ignore this because the user's bandwidth has been upgraded. It is not necessarily stable to put other users on the machine)
3. IfIf the script file is introduced before, you do not need to write document. ready, Because DOM has been loaded when the js code is executed.

 
Related Article

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.