JQuery noConflict () problem

So, I am developing a platform that introduces jQuery-1.2.6 every time the page loads. I designed my page to use jQuery-1.4.2, so when my page loads, there are 2 jQuery instances on my page.

To avoid conflict, I included the following line in my JS file, which is outside of my page:

var mc$ = jQuery.noConflict();
jQuery(function($)

Everything seems to work if I use mc $, where $ was originally used.

I get an error in Firebug and IE that I don’t know how to solve.

In the file that is introduced to the platform when my page is loaded by the developer:

 $(document).ready(function() {

and the error in Firebug is: '$ is not a function'.

This error appeared only after I made the change:

var mc$ = jQuery.noConflict();

, , mc $, - $(document).... , , , , , , , .

!

+3
3

<head> :

  • jQuery №1;
  • noConflict ;
  • jQuery №2.

.noConflict() :

<script type="text/javascript">var mc$ = jQuery.noConflict();</script>

:

mc$('#container').height();
+2

jQuery . (1.2.6) jQuery $.

http://api.jquery.com/jQuery.noConflict/ jQuery.noConflict(), jQuery, , 1.4.2 1.2.6.

, , , :)

+4

You may find this answer helpful: jquery noConflict doesn't work only in IE8

0
source

All Articles