Conflicts between jquery versions

Source: Internet
Author: User

Front-end developers know that there are many jquery versions, and there is a lot of conflict between them.
For example, when I first came to this company, my back-end buddy used jQuery 1.3.2. I went there, and my buddy hasn't updated it for a long time.
All the plug-ins I wrote are the latest jquery1.7.1.
Poor compatibility. Read books based on previous documents. Find a peaceful coexistence
<Script type = "text/javascript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"> </script>
<Script type = "text/javascript">
Var j = jQuery. noConflict (true );
</Script>
<Script type = "text/javascript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"> </script>
<Script type = "text/javascript">
$ ("Document"). ready (function (){
Alert ("jquery ");
})
J ("document"). ready (function (){
Alert ("javascript ");
})
</Script>
In this way, you can first grant $ permission to another jquery library to avoid conflicts between $ objects in different jquery versions. The above code will pop up two pop-up boxes to remove conflicts between different versions.
After running this function, you can only use j to access jquery/1.3.2 /. For example, to use $ ("div span"), replace it with j ("div span "). In addition, the jquery library is in normal use,
Author: qishuai1986

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.