jQuery对话框没有打开

时间:2013-05-02 00:54:57

标签: jquery html

我不知道为什么,但我的Jquery对话框没有出现。

html代码

 <div id="dialog" title="Uploaded Image">
     <p> sample jquery dialog  box </p>
 </div>

脚本代码

                <script>
                $(function(){
                    $("#dialog").dialog({
                        model:true,
                        show: {
                            effect: "blind",
                            duration: 1000
                        },
                        hide: {
                            effect: "blind",
                            duration: 1000
                        }
                        buttons:{
                            "Uploads": function(){
                                $(this).dialog("close");
                            }
                            "Cancel" : function(){
                                $(this).dialog("close");
                            }
                        } 
                    });
                });
            </script>

我正在使用chrome

2 个答案:

答案 0 :(得分:2)

您在","之后和hide

之内缺少逗号分隔符button

试试这个

$(function(){
     $("#dialog").dialog({
      modal:true,
      show: {
              effect: "blind",
              duration: 1000
            },
      hide: {
              effect: "blind",
              duration: 1000
             },
      buttons:{
               "Uploads": function(){
                             $(this).dialog("close");
                            },
                "Cancel" : function(){
                              $(this).dialog("close");
                            }
                        } 
                    });
                });

JS Fiddle Demo

答案 1 :(得分:2)

您的脚本遗失了一些,}

$(function(){
    $("#dialog").dialog({
        modal:true,
        show: {
            effect: "blind",
            duration: 1000
        },
        hide: {
            effect: "blind",
            duration: 1000
        }, //Missing ,
        buttons:{
        "Uploads": function(){
            $(this).dialog("close");
        }, //Missing ,
        "Cancel" : function(){
            $(this).dialog("close");
        }
    }
  });
});

演示:Fiddle