Latest Entries »

Showing posts with label jquery. prototype. Show all posts
Showing posts with label jquery. prototype. Show all posts

Sunday, November 7, 2010

solution for prototype.js and jquery.js conflict problems

Jquery have provide a solution for prototype.js and jquery.js conflicts. There is one caveat: By default, jQuery uses "$" as a shortcut for "jQuery". However, you can override that default by calling jQuery.noConflict() at any point after jQuery and the other library have both loaded. For example:


<script src="prototype.js"><⁄script>
<script src="jquery.js"><⁄script>
<script>
var $j =jQuery.noConflict();
$j(document).ready(function(){

⁄ ⁄ Use jQuery via $j(...)
$j('#button1').click(function(){
var textbox1 = $j('#textbox1').val();
alert(textbox1);

});

⁄ ⁄ Use Prototype with $(...)
$('someid').hide();

}
<⁄script>