multiple JavaScript libraries use $ number for naming conflict issues:
1. To solve this problem, JQuery provides a jquery.noconflict () method that calls the method to transfer control of the $ identifier to other libraries. The general pattern for using the Jquery.noconflict () method is as follows:
<script>
Jquery.noconflict (); Give control of the $ identifier
</script>
2. What if you want to use the $ identifier in the. Ready () method?
To solve this problem, the function function in the. Ready () method passes the parameter--jquery the object itself, using this parameter to rename JQuery to $, such as:
JQuery (document). Ready (function ($) {
Here you can use the $ identifier normally
});
Simplification method:
JQuery (function ($) {
Here you can use the $ identifier normally
});
Multiple JavaScript libraries use $ number for naming conflict issues