Dialog method supported in one page but not in another

0

I have 2 .NET web pages that have the same popup box in both pages The JavaScript is exactly the same in both pages, I copied the code from the page that works to the other page and it doesn't work. the one that doesn't work gives me the error message:

Scripts/jquery-3.3.1.js
0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'dialog'.  

I have tried putting the code at the end of the page, no difference. Best I can tell jquery is being load into the page in the header when I check the page with the IE developer. Hope someone can point me in the right direction.

<link href="Content/themes/base/jquery-ui.css" rel="stylesheet" />
<link  href ="~/Styles/Default.css"  rel="stylesheet" />
<script src="../Scripts/jquery-3.3.1.js"></script>
<script src="../Scripts/jquery-ui-1.12.1.js"></script>
<script>
    $(document).ready(function() {
        $("#dd2875").dialog({
            buttons: {
                "Cancel": function() {
                    $("#dd2875").dialog('close');
                }
            },
            dialogClass: 'myTitleClass',
            draggable: false,
            width: 800,
            height: 400,
            hide: 2000,
            show: 'slidedown',
            hide: 'explode',
            autoOpen: false
        });

        $("#btnNewAccount").click(function(evt) {
            evt.preventDefault();
            $("#dd2875").dialog('open');
        });
    });
</script>
javascript
jquery
asp.net
jquery-ui-dialog
asked on Stack Overflow Apr 3, 2018 by RVProgramer • edited Apr 3, 2018 by Stefan Crain

3 Answers

0

The DOM probably does not contain an element with the ID dd2875,

Verify that #dd2875 actually exists on the page at the point that you are calling dialog()

answered on Stack Overflow Apr 3, 2018 by stackoverfloweth
0

I entered the code you sent and this is what I got back in the console.

jQuery.Deferred exception: Object doesn't support property or method dialog' TypeError: Object doesn't support property or method 'dialog'
 at Anonymous function (http://localhost:60086/Add_CAC_ID.aspx:14:13)
at mightThrow (http://localhost:60086/Scripts/jquery-3.3.1.js:3534:10)
at Anonymous function (http://localhost:60086/Scripts/jquery-3.3.1.js:3602:12) undefined
answered on Stack Overflow Apr 4, 2018 by RVProgramer
0

I figured it out, had to go back and rewrite the page one section at a time to do it. The problem was a conflict between the JavaScript and the asp validation controls. When I put the control on the page it caused the error with the dialog. I found two solutions to the conflict. I could add the first line in the page load or the second line in the JavaScript either one worked. Thanks for the help in getting me pointed in the right direction.

Unobtrusivevalidaionmode = Unobtrusivevalidaionmode .none
or 
$j = $.noConflict;
answered on Stack Overflow Apr 6, 2018 by RVProgramer

User contributions licensed under CC BY-SA 3.0