0

My html file has various functions which requires two different jquery versions. In the head section I have them loaded like this:

        <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.min.js"></script>
<script type="text/javascript">
  var $jq16 = $.noConflict(true);
</script>

<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
    <script type="text/javascript">
      var $jq21 = $.noConflict(true);
    </script>

I mostly need to use jquery-2.1.0.min.js so in all my scripts I've replaced every single $ with $jq21.

For instance, if I ony include jquery-2.1.0 in my page and leave out v1.6, then the following script works fine. But when I include v1.6, and switch $ to $jq21, and also include the noConflict code, this script doesn't work:

 <script>

    $jq21('#form-signup_v1').validate({
        submit: {
            settings: {
                inputContainer: '.field'
            },
            callback: {
                onBeforeSubmit: function (node) {

                    myBeforeSubmitFunction(':D', ':)', node);

                },
                onSubmit: function (node) {

                    console.log('#' + node.id + ' has a submit override.');

                    //node.submit();

                }
            }
        },
        debug: true

    });

    function myBeforeSubmitFunction(a, b, node) {
 document.getElementById("form-signup_v1").submit();
        console.log(a, b);

        $jq21(node).find('input:not([type="submit"]), select, textarea').attr('readonly', 'true');
        $jq21(node).append('<div class="ui active loader"></div>');

    }
</script>

Every $ on the page is switched to $jq21 and the scripts won't work.

Any ideas? Thank you.

Nova
  • 423
  • 1
  • 10
  • 36

0 Answers0