Hello,
I am using prototype + jquery on a site. Now the prototype plugins use $. I do not want jQuery to use $. How do I make jQuery not register the $. Also, how do I then call jQuery functions.
Thank you for your time.
Hello,
I am using prototype + jquery on a site. Now the prototype plugins use $. I do not want jQuery to use $. How do I make jQuery not register the $. Also, how do I then call jQuery functions.
Thank you for your time.
The jQuery documentation has an article on how to make jQuery play nice with other libraries.
This is one suggested way from that article:
<html>
<head>
<script src="prototype.js"></script>
<script src="jquery.js"></script>
<script>
jQuery.noConflict();
// Put all your code in your document ready area
jQuery(document).ready(function($){
// Do jQuery stuff using $
$("div").hide();
});
// Use Prototype with $(...), etc.
$('someid').hide();
</script>
</head>
<body></body>
</html>
jQuery(...).You can use jQuery.noConflict( ); And then you can remap it like this: $j = jQuery;
You can use jquery's noConflict method:
var jQ=jQuery.noConflict();
now onwards you can use jQ in place of "$" to work with jQuery functions and use $ for prototype.
this is what I use if it's only a small bit of jQuery
jQuery(function($) {
// now you can use $ again within here - this block of code is fired on DOM ready
});