Running jQuery and prototype scripts together


#1

Hi

I have a rails appplication that uses jquery and prototype for
different features.

When adding the jquery library it seems all features in the
application that uses prototype stop working.

Should this happen? and if this is the case, how can I solve this?

Many Thanks in advance.


#2

Both jquery and prototype using $ sign for accessing DOM, you should
change it to jQuery instead.

jQuery(‘your_variable’).method()

http://docs.jquery.com/Using_jQuery_with_Other_Libraries


#3

You’ll need to execute this after you load the jQuery file…

jQuery.noConflict();

Robby

On Mon, May 25, 2009 at 11:06 AM, lyntaff removed_email_address@domain.invalid wrote:

Many Thanks in advance.


Robby R.
Chief Evangelist, Partner

PLANET ARGON, LLC
design // development // hosting w/Ruby on Rails

http://planetargon.com/
http://robbyonrails.com/
http://twitter.com/planetargon
aim: planetargon

+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4068 [fax]


#4

Robby R. wrote:

You’ll need to execute this after you load the jQuery file…

jQuery.noConflict();

Robby

On Mon, May 25, 2009 at 11:06 AM, lyntaff removed_email_address@domain.invalid wrote:

Many Thanks in advance.


Robby R.
Chief Evangelist, Partner

PLANET ARGON, LLC
design // development // hosting w/Ruby on Rails

http://planetargon.com/
http://robbyonrails.com/
http://twitter.com/planetargon
aim: planetargon

+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4068 [fax]

Mine is the total opposite, maybe:), thats if my setup is configured
correctly.

I put my jquery-1.3.2.js in my projects /public/javascripts folder.

I created a js script called jo.js in /public/javascripts that looks
like this:
$(document).ready(function() {
$(‘a’).click(function() {
$(’#box’).fadeout(‘slow’);
});

});

This is how I referenced the jo.js file in my html file:

index <%= javascript_include_tag "jo.js" %> <%= stylesheet_link_tag "jcss" %>
Click Me!

When i click on the click me link the box above it is supposed to fade
out, this is not happening.

Thanks