加载时为甜蜜警报输入设置值

Mad*_*han 2 sweetalert

在甜蜜警报 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();
            });
Run Code Online (Sandbox Code Playgroud)

Mad*_*han 7

我们可以添加另一个字段

inputValue : 'test value',
Run Code Online (Sandbox Code Playgroud)

添加完整代码后,我们可以看到它是这样的

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();
            });
Run Code Online (Sandbox Code Playgroud)