# Running jQuery and prototype scripts together

**URL:** <https://www.ruby-forum.com/t/running-jquery-and-prototype-scripts-together/168780>\
**Category:** Rails\
**Created:** [May 25, 2009, 8:07pm UTC](https://www.ruby-forum.com/t/running-jquery-and-prototype-scripts-together/168780 "2009-05-25T20:07:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lyntaff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/87869e/32.png) [@lyntaff](https://www.ruby-forum.com/u/lyntaff)\
**Post date:** [May 25, 2009, 8:07pm UTC](https://www.ruby-forum.com/t/running-jquery-and-prototype-scripts-together/168780/1 "2009-05-25T20:07:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lyntaff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/87869e/32.png) [@lyntaff](https://www.ruby-forum.com/u/lyntaff)\
**Post date:** [May 26, 2009, 1:42am UTC](https://www.ruby-forum.com/t/running-jquery-and-prototype-scripts-together/168780/2 "2009-05-26T01:42:22Z")

</div>

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](http://docs.jquery.com/Using_jQuery_with_Other_Libraries)

---

<div class="post-metadata">

**Author:** ![lyntaff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/87869e/32.png) [@lyntaff](https://www.ruby-forum.com/u/lyntaff)\
**Post date:** [May 26, 2009, 2:28am UTC](https://www.ruby-forum.com/t/running-jquery-and-prototype-scripts-together/168780/3 "2009-05-26T02:28:39Z")

</div>

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](mailto: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

> **[Planet Argon](https://www.planetargon.com/)**
>
> Planet Argon is a Ruby on Rails development agency specializing in maintenance and support for existing Rails apps. Based in Portland, OR, Planet Argon has been a member of the Rails community since 2004.

[http://robbyonrails.com/](http://robbyonrails.com/)  
[http://twitter.com/planetargon](http://twitter.com/planetargon)  
aim: planetargon

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

---

<div class="post-metadata">

**Author:** ![lyntaff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/87869e/32.png) [@lyntaff](https://www.ruby-forum.com/u/lyntaff)\
**Post date:** [June 8, 2009, 8:03pm UTC](https://www.ruby-forum.com/t/running-jquery-and-prototype-scripts-together/168780/4 "2009-06-08T20:03:52Z")

</div>

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](mailto: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://planetargon.com/)  
> [http://robbyonrails.com/](http://robbyonrails.com/)  
> [http://twitter.com/planetargon](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
