JavaScript confirm box with custom buttons

后端 未结 3 456
伪装坚强ぢ
伪装坚强ぢ 2020-12-18 23:05

Can I write a custom confirm box in JavaScript that, instead of the default OK and CANCEL button, shows a SAVE and DELETE

3条回答
  •  长情又很酷
    2020-12-18 23:28

    $('confirm text').dialog(
        {
            modal:true, //Not necessary but dims the page background
            buttons:{
                'Save':function() {
                    //Whatever code you want to run when the user clicks save goes here
                 },
                 'Delete':function() {
                     //Code for delete goes here
                  }
            }
        }
    );
    

    This should work, but you will need to download or link to jQuery and the jQuery UI libraries to run this.

提交回复
热议问题