Run this function to assign control of variable $ to the first database to implement it.
This helps ensure that jquery does not conflict with $ objects in other libraries.
<SCRIPT type = "text/JavaScript" src = "/javascripts/jquery. js"> </SCRIPT>
<SCRIPT type = "text/JavaScript">
VaR J $ =$;
Jquery. noconflict ();
</SCRIPT>
<SCRIPT type = "text/JavaScript" src = "/javascripts/prototype. js"> </SCRIPT>
After running this function, you can only use jquery variables to access jquery objects. For example, to use $ ("Div P"), you must replace it with J $ ("Div P ").
Note: This function must be used after you import the jquery file and before importing another library that causes the conflict. Of course, it should also be before other conflicting libraries are used, unless jquery is the last imported.
Method 1:
Jquery. noconflict ();
// Use jquery
J $ ("Div P"). Hide ();
// Use $ () for other libraries ()
$ ("Content"). style. Display = 'none ';
Method 2:
// My website viqiwu.com
VaR viqiwu = jquery. noconflict ();
// Jquery-based code
Viqiwu ("Div P"). Hide ();
// $ () Code based on other libraries
$ ("Content"). style. Display = 'none ';
In this way, you don't have to worry about jquery conflicts with other JS frameworks.