Javascript 模态确认jquery建议

Javascript 模态确认jquery建议,javascript,jquery,modal-dialog,Javascript,Jquery,Modal Dialog,我需要一些基本的帮助。基本上,我试图创建一个模式确认对话框,我已经记下了大部分内容。简单地说,这是一个对话,问你确定吗?有两个按钮是和否 <script> $(function() { $( "#dialog-confirm" ).dialog({ resizable: false, height:140, modal: true, buttons: { "Yes": function()

我需要一些基本的帮助。基本上,我试图创建一个模式确认对话框,我已经记下了大部分内容。简单地说,这是一个对话,问你确定吗?有两个按钮是和否

<script>
$(function() {
    $( "#dialog-confirm" ).dialog({
        resizable: false,
        height:140,
        modal: true,
        buttons: {
            "Yes": function() {},
            "No": function() {
                $( this ).dialog( "close" );
            }
        }
    });
});
</script>
统计数据就在这里:节能:


我的新问题是:为什么“确认”按钮没有将我链接到该链接?

要运行什么脚本?它既没有显示也没有引用。我假设它叫做myFunction

...
        buttons: {
            "Yes": function() {
                // some code here when yes was clicked
                $( this ).dialog( "close" );
             },
            "No": function() {
                $( this ).dialog( "close" );
            }
...
这是一个


注意:请将它们标记为jqueryui

有趣的是,我需要弄清楚Yes:funition{…}中的内容。好的,这很有帮助。只有一个问题。在myFunction中,如何调用对话框插入的脚本;'我认为这很清楚,因为您可以在按钮处理程序中为处理程序和interruptFunction设置一些变量,并检查该变量。或者为什么要返回到它?为什么不在myFunction中执行您将要执行的操作?也许你是喜欢承诺模式的人之一。这里有一个
...
        buttons: {
            "Yes": function() {
                // some code here when yes was clicked
                $( this ).dialog( "close" );
             },
            "No": function() {
                $( this ).dialog( "close" );
            }
...
$(".confirm").click(function(e) {
    e.preventDefault();
    var targetUrl = $(this).attr("href");
    var $dialog-confirm = $('<div></div>').
        html("<p>Are you sure?</p>").
        dialog({autoOpen: false,
        title: 'Please Confirm',
        buttons : {
            "Yes" : function() {....},
            "No" : function() {....}
        },
        modal: true
    });

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