Found a solution to conflicts between jQuery and Prototype

Source: Internet
Author: User

In the past, it seems that jQuery conflicts with prototype, but it never cares. Today, I put the message prompt box special effects I wrote with the jquery framework into the company's original system and found that all the message prompts went on!
After sweating for a long time, I still did not find the cause. I suddenly thought of the conflict between jquery and prototype. Only then did I find that many pages of the company's original system call the prototype framework. If you know the reason, try to solve the problem. I will never try again without jquery. I searched the internet and finally found some solutions. This is:
1. Put jquery. js behind prototype. js (this is required; otherwise, it will still be on strike in any case ).
2. Rename the $ variable after jquery. js.
The method is as follows:
Copy codeThe Code is as follows:
<Script type = "text/javascript" type = "text/javascript" src = "window. js"> </script>
<! -- The preceding window. js calls the jquery framework method -->
<Script type = "text/javascript" type = "text/javascript" src = "prototype. js"> </script>
<Script type = "text/javascript" src = "jquery. js"> </script>
<Script type = "text/javascript">
Var jQuery =$;
</Script>

3. replace all the original $ method names with jQuery names, for example, $ ("obj") with jQuery ("obj ").

Follow the three steps above to solve the problem quickly.

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.