我有这个代码
var pass = prompt("Please enter your password:", "");
我想通过Sweet Alert发出此提示并将其保存在可变传递中。到目前为止,我已经做到了,但是我不知道如何将其保存到变量中。
swal({
content: {
element: "input",
attributes: {
placeholder: "Type your password",
type: "password",
},
},
});
答案 0 :(得分:0)
您可以执行以下操作:
var pass = null;
swal({
content: {
element: "input",
attributes: {
placeholder: "Type your password",
type: "password",
}
}
})
.then(function(value) {
pass = value;
});