-
handling conflicts between jquery versions
-
front-end developers all know that there are a lot of jquery versions, and the conflict is tangled.
For example, when I first came to this company, the back end of the buddies with the jquery 1.3.2, I went, the man has not been updated for a long time.
The effect plug-ins I wrote are the newest jquery1.7.1.
not compatible with the egg pain Ah, refer to previous information, reading. 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 () { Br>alert ("jquery");
})
J ("Document"). Ready (function () {
Alert ("JavaScript");
})
</script>
Roughly means that the use of permissions is given to another jquery library, which avoids conflicts between the $ objects in different jquery versions. The above code can pop up two popup boxes, you can release the conflict between different versions.
After running this function, you can only use J to access jquery/1.3.2/. For example, if you want to use $ ("div span"), you need to change to J ("Div span"). Another jquery library is working,
Handling conflicts between jquery versions