2017-07-21 60 views
1

負荷設定值在甜蜜的警報2,如何負載設置在輸入 我甜蜜的警報代碼值在甜警報輸入

swal({ 
       title: 'Are you sure?', 
       text: "You are going to send emails from the system. Please confirm",     
       showCancelButton: true, 
       input: 'email', 

       confirmButtonText: 'Submit', 
       confirmButtonColor: '#4aa0f1', 
       cancelButtonColor: '#898b8e', 
       confirmButtonText: 'Send' 
      }).then(function (email) { 
       send_email = email; 
       sentHtmtBody_send(); 
       loadingIcon(); 
      }); 

回答

2

我們可以添加後添加一個字段

inputValue : 'test value', 

它完整​​的代碼,我們可以看到它是這樣的

swal({ 
       title: 'Are you sure?', 
       text: "You are going to send emails from the system. Please confirm",     
       showCancelButton: true, 
       input: 'email', 
       inputValue: "E.g john", 
       confirmButtonText: 'Submit', 
       confirmButtonColor: '#4aa0f1', 
       cancelButtonColor: '#898b8e', 
       confirmButtonText: 'Send' 
      }).then(function (email) { 
       send_email = email; 
       sentHtmtBody_send(); 
       loadingIcon(); 
      });