Forum: Ruby on Rails How to resolve JavaScripts Conflict

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C42c706fab23da0b6d3cd2cfbb8db27d?d=identicon&s=25 Salil Gaikwad (salil)
on 2009-02-25 14:57
How to resolve the javascripts conflicts between jQuery.js and
prototype.js.

Thanks
Salil
83ca41657a99b65d99889abe712ba5e2?d=identicon&s=25 Jason Roelofs (Guest)
on 2009-02-25 15:27
(Received via mailing list)
http://lmgtfy.com/?q=jquery+with+prototype

On Wed, Feb 25, 2009 at 8:57 AM, Salil Gaikwad
40db9e75b3f5899258e3bdc0c9210154?d=identicon&s=25 Conrad Taylor (conradwt)
on 2009-02-25 15:27
(Received via mailing list)
On Wed, Feb 25, 2009 at 5:57 AM, Salil Gaikwad <
rails-mailing-list@andreas-s.net> wrote:

>
> How to resolve the javascripts conflicts between jQuery.js and
> prototype.js.
>

 Hi, what conflict you're having in regards to jQuery and prototype?
I'm
guess that you're talking
about the use of $(...).  Here's a good post on a blog:

http://disjointthoughts.com/2007/08/17/getting-thi...

Good luck,

-Conrad
C42c706fab23da0b6d3cd2cfbb8db27d?d=identicon&s=25 Salil Gaikwad (salil)
on 2009-02-25 16:10
Thanx 2 both of u for a quick reply.
My problem is if Both libraries included then only first library works.
i.e. if i include prototype.js then jQuery.js then only prototype.js
works.
on change select list and toggle box which used jQuery.js doesn't work.





Conrad Taylor wrote:
> On Wed, Feb 25, 2009 at 5:57 AM, Salil Gaikwad <
> rails-mailing-list@andreas-s.net> wrote:
>
>>
>> How to resolve the javascripts conflicts between jQuery.js and
>> prototype.js.
>>
>
>  Hi, what conflict you're having in regards to jQuery and prototype?
> I'm
> guess that you're talking
> about the use of $(...).  Here's a good post on a blog:
>
> 
http://disjointthoughts.com/2007/08/17/getting-thi...
>
> Good luck,
>
> -Conrad
C42c706fab23da0b6d3cd2cfbb8db27d?d=identicon&s=25 Salil Gaikwad (salil)
on 2009-02-25 16:16
i am using......

Prototype JavaScript framework, version 1.6.0.1

jQuery 1.2.3 - New Wave Javascript

rails-2.0.2
A1b97dafea62b11e7b3bef338ce3fe83?d=identicon&s=25 Billy Hsu (cfc)
on 2009-02-25 16:31
(Received via mailing list)
I will include jquery first, than include prototype:

<head>
  <%= javascript_include_tag "jquery" %>
  <script>var $j = jQuery.noConflict(); </script>
  <%= javascript_include_tag "prototype" %>
</head>

or You can write jQuery code by this way:

<script>
  (function($){/* Write jQuery Codes in here */})(jQuery);
</script>

On Wed, Feb 25, 2009 at 11:16 PM, Salil Gaikwad <
rails-mailing-list@andreas-s.net> wrote:

>
> >
>


--
TWRUG Blog:
http://blog.rubyonrails.org.tw

CFC on Rails:
http://zusocfc.blogspot.com

Only two surfaces of a box:
http://blog.pixnet.net/zusocfc
This topic is locked and can not be replied to.