Currently working on a personal project. I want the user to click a button and a SweetAlert prompt would be presented for the user to verify their credential. However, the code I see on the SweetAlert website only allows one input field. Here is the code I have:
JavaScript
x
17
17
1
swal({
2
title: "Authenicating for continuation",
3
text: "Test",
4
type: "input",
5
showCancelButton: true,
6
closeOnConfirm: false,
7
animation: "slide-from-top",
8
inputPlaceholder: "Write something"
9
}, function(inputValue) {
10
if (inputValue === false) return false;
11
if (inputValue === "") {
12
swal.showInputError("You need to write something!");
13
return false
14
}
15
// swal("Nice!", "You wrote: " + inputValue, "success");
16
});
17
So, is there a way I can get two input fields? One input field for the password and the other input field for text.
Advertisement
Answer
As far as I know you can’t do this off-the-shelf. You can either fork and implement, or just use a HTML element as a modal (e.g. as in Bootstrap’s modals).