Simultaneous invocation of prototype and jquery conflict resolution

Source: Internet
Author: User

In the development application will often encounter to call prototype and jquery at the same time, but they will have conflicts, let's look at the conflict resolution

The method is as follows:

1, put the jquery.js behind the prototype.js (this is necessary or, in any case, to strike).
2. After jquery.js, rename the $ variable.

Code

<script type= "text/web Effects" type= "Text/javascript" src= "Window.js" ></script>
<!--the above Window.js calls the jquery framework approach-->
<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 the original $ method name with the jquery name, such as $ ("obj"), and replace it with jquery ("obj").

Note: Var jquery=$ of which the jquery name can be freely obtained under the premise of no conflict.

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.