jQuery UI对话框无法打开?

时间:2011-07-13 15:56:59

标签: jquery jquery-ui modal-dialog

我想在用户点击删除按钮(输入类型=“提交”)时打开对话框,但没有任何反应,甚至没有JS错误。

代码:

$(function() {  

$( "#dialog-confirm" ).dialog({
        autoOpen: false,
        resizable: true,
        modal: true,
        overlay: {
            backgroundColor: '#000',
            opacity: 0.5
        },
        buttons: {
            "Delete": function() {

                    $.ajax({
                        type: "post",
                        url: "delete.php",
                        data: "eridTBD=" + eridTBD,
                        context: $( "h1" ).first(),

                        error: function(){

                            $( this ).after( "<p>no dice</p>" );

                        },

                        success: function( results ){

                            $( this ).after( results )

                        }               
                    });

                    $( this ).dialog("close");
            },

            Cancel: function() {
                $( this ).dialog("close");
            }
        }
});


$( ".delete_form input[name=delete]" ).click(function() {

        $( "dialog-confirm" ).dialog( "open" );
        return false;
});

});

有什么建议吗?

1 个答案:

答案 0 :(得分:1)

错过了英镑符号:

$( "dialog-confirm" ).dialog( "open" );

应该是

$( "#dialog-confirm" ).dialog( "open" );