Reputation: 9
I have this code
var pass = prompt("Please enter your password:", "");
I want to make this prompt through Sweet Alert and save it in variable pass. So far I have done this but I don't know how to save it in a variable.
swal({
content: {
element: "input",
attributes: {
placeholder: "Type your password",
type: "password",
},
},
});
Upvotes: 0
Views: 1317
Reputation: 13462
You can do something like:
var pass = null;
swal({
content: {
element: "input",
attributes: {
placeholder: "Type your password",
type: "password",
}
}
})
.then(function(value) {
pass = value;
});
Upvotes: 1