Home  >  Article  >  Web Front-end  >  Found a solution to the conflict between jQuery and Prototype_javascript skills

Found a solution to the conflict between jQuery and Prototype_javascript skills

WBOY
WBOYOriginal
2016-05-16 19:09:30974browse

I seem to have seen somewhere before that there is a conflict between jQuery and prototype, but I never paid attention to it. Today I put the message prompt box effects I wrote using the jquery framework into the company's original system and found that all the message prompt effects were broken!
After sweating for a long time, I still couldn’t find the reason. I suddenly thought of the conflict between jquery and prototype, and then I discovered that many pages of the company’s original system called the prototype framework. Once you know the reason, let’s find a way to solve it. I won’t have to break away from jquery and write it again. I searched the Internet and finally found some solutions. This is:
1. Put jquery.js into prototype. .js behind (this is necessary otherwise it will still fail anyway).
2. Rename the $ variable after jquery.js.
The method is as follows:

Copy code The code is as follows:







3 . Replace the original $ method name with the jQuery name, such as $("obj") with jQuery("obj").

Follow the above three steps and the problem will be solved quickly.​
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn