开发者

Toggle view of modal button

I have the following modal dialog:

$(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" );
            }
        },
});
});

How can I toggle the 'Add Location' button? I want it to display only when a certain button within the dialog is clicked.

Thanks,


You can do it like this:

  1. hide you add location button as soon as dialog is shown on screen. call this after the dialog open command

    $("button[value='Add Location']").hide();
    
  2. Then add event to the desired button that will toggle the add location button

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜