jQuery-UI对话框不会显示按钮

时间:2012-08-10 09:00:33

标签: javascript jquery-ui jquery-ui-dialog

我有一个奇怪的问题,也许解决方案很简单。

我的对话框正在显示,但没有给定的按钮。请帮帮我。

我有:

 <div id="dialog">Are you sure you want to delete this user?</div>
  <script type="text/javascript">
  function openDialog(usrId){
    $("#dialog").dialog({
        buttons: {
            'Delete': function(){ 
                window.location = '/user/index/remove-user/usrId/'+usrId
            },
            'Cancel': function(){
                $(this).dialog('close')
            }
        }
        }).dialog("open");

    return false;
}
</script>

2 个答案:

答案 0 :(得分:0)

您是否包含所有Jquery Dialog js / css文件?

答案 1 :(得分:0)

自己找到解决方案:

<div id="dialog">Are you sure you want to delete this user?</div>
<script type="text/javascript">
function openDialog(usrId){
    $("#dialog").dialog("option", "buttons",  
            {
                'Delete':function(){ window.location = '/user/index/remove-user/usrId/'+usrId; $(this).dialog("close"); }
            ,
                'Cancel':function(){ $(this).dialog('close') } 
            }
    ).dialog("open");

    return false;
}
</script>