jQuery-ui dialog - hide buttons using jquery

前端 未结 4 1335
-上瘾入骨i
-上瘾入骨i 2021-01-07 04:38

How do I remove/hide the \"Ok\" button dynamically using jquery?

$(\'#dialog-save\').dialog({
            autoOpen: false,
            modal: false,
                


        
4条回答
  •  不要未来只要你来
    2021-01-07 05:23

    One commonly overlooked feature of the UI dialog is that you can set various other properties of the buttons, including 'class' and 'id'. These can be very useful if you need to manipulate the buttons after instantiation.

    For example...

    $('#dialog-save').dialog({
            autoOpen: false,
            modal: false,
            draggable: true,
            width: 275,
            height: 175,
            {
                id: 'okBtn',
                text: "Ok",
                click: function () {
                    $(this).dialog("close");
                }
            }]
        });
    
    // And then at some other point in the code...
    $('#okBtn').remove();
    

提交回复
热议问题