views:

49

answers:

3

WHY is it that i cannot use Scriptaculous and jQuery in the same page without calling: jQuery.noConflict() ?

+3  A: 

Because they both use the $ variable in the global namespace.

Eric Martin
all right, good to know. Thank you!
Lucian
@Lucian: If an answer helped in solving the problem, you should mark it accepted.
BalusC
How do i do that ?
Lucian
asked too fast, i found it
Lucian
+1  A: 

WHY is it that i cannot use Scriptaculous and jQuery in the same page without calling: jQuery.noConflict() ?

If you were able to use different javascript libraries on same page, the very existence of jQuery.noConflict() was not needed. It is because of special symbol $ which holds special meaning in those different javascript libraries.

Sarfraz
A: 

You can use $ in the following scenario:

jQuery.noConflict(); // Put all your code in your document ready area jQuery(document).ready(function($){ // Do jQuery stuff using $ $("div").hide(); }); // Use Prototype with $(...), etc. $('someid').hide();

I think it's the best way of using libraries which had the same $ function

Nik