切换模态按钮的视图

时间:2011-04-13 10:11:13

标签: javascript jquery

我有以下模态对话框:

$(document).ready(function() {
$( "#addLocation" ).dialog({
        modal: true,
        height: 820,
        width: 550,
        buttons: {
            "Add Location": function() {
                document.forms['mapform'].submitted.value='1';
                document.forms["mapform"].submit();
            },
            Cancel: function() {
                $( this ).dialog( "close" );
            }
        },
});
});

如何切换“添加位置”按钮?我希望它只在单击对话框中的某个按钮时显示。

谢谢,

1 个答案:

答案 0 :(得分:0)

你可以这样做:

  1. 在屏幕上显示对话框后立即隐藏您添加位置按钮。在对话框打开命令

    之后调用它
    $("button[value='Add Location']").hide();
    
  2. 然后将事件添加到所需按钮,该按钮将切换添加位置按钮

    $("buttonid or any selector").click(function(){
    $("button[value='Add Location']").show();
    });
    
相关问题