jQuery - jQuery running with prototype
Search
Tag Search
php
client-side
htaccess
flash
seo
regular expressions
apache
301 redirect
cache
hand drawing
subdomain
bugs
print design
disable cache
svn
javascript
jquery
regex
plugin
art
thickbox
AJAX
html
action script
car
Recently Added
- HTML [3 items]
- SVN (Subversion) [3 items]
- jQuery [10 items]
- PHP [4 items]
Most Popular
- jQuery [10 items]
- PHP [4 items]
- SVN (Subversion) [3 items]
- HTML [3 items]
Member Options
20
Aug
Created by: robilim - Date Added: 20th August 2010 - 0 Responses
jQuery was nice enough to add in a function that helps with conflicting scripts. Typically prototype and jQuery use the $ sign to initialise their scripts. Code to help you achieve no conflicts:
//include your prototype
//include your jquery
//typical jQuery call
$(document).ready(function(){
$("body").css("background", "red");
});
//now that jquery code can be run with conflict like this:
jQuery(document).ready(function(){
jQuery("body").css("background", "red");
});
//but prefixing with that every time not only adds more characters to the code, it just gets annoying
//so use the .noConflict function provided by jquery library
$j = jQuery.noConflict(); //assign a new variable to initialise jquery calls
$j(document).ready(function(){
$j("body").css("background", "red");
});
So after using the function supplied by jQuery, you shouldn't have problems running both at the same time. Good luck.

