JavaScript confirm box with custom buttons

后端 未结 3 454
伪装坚强ぢ
伪装坚强ぢ 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条回答
  •  猫巷女王i
    2020-12-18 23:28

    Use the jQuery UI Dialog Box for this.

    You can do something like this:

    JS:

    $(function() {
      $("#dialog-confirm").dialog({
        resizable: false,
        height: "auto",
        width: 400,
        modal: true,
        buttons: {
          "Do it": function() {
            $(this).dialog("close");
          },
          Cancel: function() {
            $(this).dialog("close");
          }
        }
      });
    });
    
      
    
    
    
    
    
    
    
    

    Am I the Senate?

提交回复
热议问题