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.