4

All -

I am facing an issue with jquery UI dialog. There are multiple version of jquery on the page I am working. The code for calling jquery UI dialog is as follows:

<link href="http://code.jquery.com/ui/1.9.2/themes/smoothness/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>

<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.min.js"></script>

<script type="text/javascript" src="plugin.js"></script>


<script type="text/javascript">
    (function($){
        $('#loadDialog').dialog({
                autoOpen: false,
                height: 455,
                width: 500,
                modal: true
            });

            $('#btnClick').on("click", function(e){
                    e.preventDefault();
                    $('#loadDialog').load('dialogContent.cfm', function() { 
                        $(this).dialog({ position: {at: "right"}});
                        $(this).dialog('open');
                        $(this).dialog('open');
                    })
                })

         }(jQuery));
</script>

html:

<div id="loadDialog" title="Dialog Window"></div>

The dialogContent.cfm that is loaded into the dialog window uses plugin.js to add content to DOM. The issue I am facing is that the dialog is no longer using version 1.10.2, but is using an older version of jQuery, there by failing to invoke the plugin. How can I make sure that the dialog window uses the latest version?

14
  • How do you know it's using an older version? It should be using the version that you include. are you including different versions of jQuery at the same time? Commented Jan 8, 2014 at 2:24
  • I checked the version on the calling page as well as on the dialog window using $.fn.jquery. Both return different versions Commented Jan 8, 2014 at 2:26
  • Are you sure it's not the plugin version that's different from the jQuery version? Can you paste the 2 versions here? Commented Jan 8, 2014 at 2:26
  • jquery versions are 1.10.2 and 1.6.2. Yes the plugin needs 1.10.2 but its using 1.6.2 which is defined later in the same page the code that is used to call the dialog window Commented Jan 8, 2014 at 2:31
  • Which version of jQuery are you including? Version requirements are usually backward compatible. If you need 1.6.2 and use 1.10.2 there should not be a problem, unless the plugin is very old and not maintained. Commented Jan 8, 2014 at 2:33

1 Answer 1

2

Have you tried this: How do I run different versions of jQuery on the same page?

You can define a different jQuery name for different versions when using them in no conflict mode.

Then use the right one to load your modal.

Sign up to request clarification or add additional context in comments.

3 Comments

But I dont want to update the plugin with the new name
$110('.selector').modal();
Yes, it did. I thought I have to update the plugin too to use the updated name for jQuery, but it worked as it is...not sure why and it would be great if someone could an explanation....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.