1

I have a page in which I include jQuery and jQuery UI to create a modal dialog from a div-element. This works fine. Now from another page with the same HTML markup and a reference to the same JavaScript files, I do the exact same thing and get the following error:

Internet Explorer 8:

Object doesn't support this property or method

Chrome (26.0.1410.64):

Uncaught TypeError: Object # has no method 'dialog'

This is what the HTML looks like in both the pages:

<div id="dialog-message" class="ui-widget" style="margin-left: auto; margin-right: auto; display: none;" title="Activity Monitoring">
    <p>
        <span id="messageContainer"></span>
    </p>
</div>

And this is the code where things go wrong on the second page. Mind that the first line gets executed correctly and that the content of 'messageContainer' is set correctly:

$('#messageContainer').html(message);
$('#dialog-message').dialog({
    autoOpen: false,
    bgiframe: true,
    draggable: false,
    height: "auto",
    modal: true,
    open: function (event, ui) { $(".ui-dialog-titlebar-close").hide(); },
    position: { my: "center", at: "center", of: window },
    resizable: false,
    width: 450,
    buttons: dialogButtons
});

These are the includes of the jQuery-files. I omitted the path partially for privacy reasons but I verified it and it works as the first line of jQuery code is succesfully executed. The third include is the reference to the file where the above JavaScript code is written:

<script language="javascript" type="text/javascript" src="http://.../javascript/jquery-1.8.2.min.js"></script>
<script language="javascript" type="text/javascript" src="http://.../javascript/jquery-ui-1.10.2.custom.min.js"></script>
<script language="javascript" type="text/javascript" src="http://.../javascript/Utility.js"></script>

Am I missing or looking over something here? I cannot find out why in one page this works perfectly and in another I get the error. Thanks in advance!

7
  • I know this might be redundant but did the jquery-ui library get downloaded properly according to CDT?
    – shishirmk
    Apr 23, 2013 at 9:06
  • What is CDT? (sorry if this is stupid :D)
    – Abbas
    Apr 23, 2013 at 9:09
  • Chrome Developer Tools :P
    – shishirmk
    Apr 23, 2013 at 9:10
  • 1
    check if you do not include jquery ui twice... Apr 23, 2013 at 9:14
  • 1
    @abbas, because the first line uses only jQuery and not jQuery-UI Apr 23, 2013 at 9:32

1 Answer 1

1

check if you do not include jquery ui twice

1
  • The problem was indeed that there was a second include somewhere on the SharePoint page of an older version of jQuery. :)
    – Abbas
    Apr 23, 2013 at 10:38

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.