javascript - jQueryUI Dialog Box not working - Why? - Stack Overflow

I just can't figure this one out. The Dialog Box doesn't popup. I've tried all sorts of

I just can't figure this one out. The Dialog Box doesn't popup. I've tried all sorts of things but it just doesn't work. Here's my code:

<head>
    <script type="text/javascript" src="/js/jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="/js/jquery-ui-1.8.20.custom.min.js"></script>
</head>
<body>
<script>
$(function() {
    // Dialog
    $('#dialog').dialog({
            autoOpen: false,
            width: 600,
            buttons: {
                    "Ok": function() {
                            $(this).dialog("close");
                    },
                    "Cancel": function() {
                            $(this).dialog("close");
                    }
            }
    });

    // Dialog Link
    $('#dialog_link').click(function(){
            $('#dialog').dialog('open');
            return false;
    });
});  
</script>

<a href="#" id="dialog_link">Open Dialog</a>

<div id="dialog">This should popup</div>
</body>

What's wrong here? Any help appreciated.

I just can't figure this one out. The Dialog Box doesn't popup. I've tried all sorts of things but it just doesn't work. Here's my code:

<head>
    <script type="text/javascript" src="/js/jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="/js/jquery-ui-1.8.20.custom.min.js"></script>
</head>
<body>
<script>
$(function() {
    // Dialog
    $('#dialog').dialog({
            autoOpen: false,
            width: 600,
            buttons: {
                    "Ok": function() {
                            $(this).dialog("close");
                    },
                    "Cancel": function() {
                            $(this).dialog("close");
                    }
            }
    });

    // Dialog Link
    $('#dialog_link').click(function(){
            $('#dialog').dialog('open');
            return false;
    });
});  
</script>

<a href="#" id="dialog_link">Open Dialog</a>

<div id="dialog">This should popup</div>
</body>

What's wrong here? Any help appreciated.

Share Improve this question asked May 28, 2012 at 13:49 Tomi SeusTomi Seus 1,1612 gold badges13 silver badges28 bronze badges 6
  • 2 works fine here – Joseph Commented May 28, 2012 at 13:51
  • Any errors in the console? What you have looks fine – Rory McCrossan Commented May 28, 2012 at 13:52
  • Why does this need to be in a function? Set it in document ready like this -> jsfiddle/h7qNR/2 – Undefined Commented May 28, 2012 at 13:53
  • do you get any script errors? – TRR Commented May 28, 2012 at 13:54
  • 1 I think the script tag just after body missing type="text/javascript". ie. <body><script type="text/javascript">... – thecodeparadox Commented May 28, 2012 at 13:54
 |  Show 1 more ment

6 Answers 6

Reset to default 2

Try to use this it might be work.

<link rel="stylesheet" href="https://ajax.googleapis./ajax/libs/jqueryui/1.11.3/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis./ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script>

Where is jquery.ui.dialog.js in this scode?????

Please add this file into code as script tag....

you can put this JS file from here :

http://jqueryui./ui/jquery.ui.dialog.js

<script></script> is not enough. Should be <script type="text/javascript"></script>

I think the script tag just after body missing type="text/javascript". ie. <body><script type="text/javascript">...

You have to include the script block after the

<a href="#" id="dialog_link">Open Dialog</a>
<div id="dialog">This should popup</div>

block just before the body element and it should work.

You have to include also all the styling of the jQuery UI so that it looks nicer.

I have a same problem. It is probably a patibility issue, try including the below instead of what you have

<script src="http://ajax.googleapis./ajax/libs/jqueryui/1.8.22/jquery-ui.min.js" type="text/javascript"></script>

Also to display the dialog properly, replace jquery-ui-1.8.xx.custom.css to match the jquery-ui.min.js version, I could not find a google ajax link.

I want to find an alternative solution but no idea if I can find one.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744154476a4560790.html

相关推荐

  • javascript - jQueryUI Dialog Box not working - Why? - Stack Overflow

    I just can't figure this one out. The Dialog Box doesn't popup. I've tried all sorts of

    8天前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信