开发者

Toggle view of modal button

开发者 https://www.devze.com 2023-02-24 02:11 出处:网络
I have the following modal dialog: $(document).ready(function() { $( \"#addLocation\" ).dialog({ modal: true,

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

精彩评论

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

关注公众号