0

I tried using jQuery_1_9_1 and jQuery_1_4_2 in the same page But when trying to open popups in my page I am getting Undefined type Err 'Undefined is not a function' at this point

jQuery_1_9_1.fn.track=function(){
    jQuery_1_9_1(this).each(function(){
        return new Track(jQuery_1_9_1(this));

Also I am using Mootools in my page . Could anyone pls help why I am getting this error.

Edit

<script type='text/javascript' src='../assets/js/jquery-1.4.2.min.js'></script>
<script type='text/javascript'> var jq = jQuery.noConflict(); </script>

I have given 1.4.2 in my template file and

<script type='text/javascript' src='../assets/js/jquery-1.9.1.min.js'>
<script type="text/javascript"> var jQuery_1_9_1 = jQuery.noConflict(true); </script> 

in one of the commonly used JSP

empiric
  • 7,825
  • 7
  • 37
  • 48
  • Please show how you include the different versions, and how you set the `jQuery_1_9_1` variable. – nnnnnn Mar 24 '15 at 07:04
  • I have given 1.4.2 in my template file and in one of the commonly used JSP – Gayathri s kumar Mar 24 '15 at 07:09
  • how do you try to open the popup? Could you add the code to your question as it is the cause for the error? – newBee Mar 24 '15 at 07:12
  • Possible duplicate of [http://stackoverflow.com/questions/1566595/can-i-use-multiple-versions-of-jquery-on-the-same-page](http://stackoverflow.com/questions/1566595/can-i-use-multiple-versions-of-jquery-on-the-same-page) – lshettyl Mar 24 '15 at 07:19
  • try ``...$.noConflict...`` – newBee Mar 24 '15 at 07:46

1 Answers1

0

First of all, you DO NOT NEED multiple versions of JQuery on a single page to achieve the desired functionality.

Secondly, since you are using Mootools and JQuery, best would be to use the following alternatives instead of the default $ in JQuery:

  1. Using the jQuery instance directly
  2. Using var jQ = jQuery.noConflict();

Also, it would be best for applications like this to use Asynchronous Module Definition - something like RequireJS to ensure you load only the JS files which are required for specific functionality.

ArinCool
  • 1,720
  • 1
  • 13
  • 24