Back to Recipe Gallery
In this example, we are using the html property to create login and password inputs. Note how we are applying the class swal2-input to both inputs to make them look consistent with the rest of popup.
We also add a check on the input using the preConfirm property. In the function defined for this propertty we are checking if either the user name or the password are empty, and if one of them is, we use Swal.showValidationMessage() to show an error message on the swal. This will also prevent the swal from resolving.
We are using the same preConfirm function to also construct the return value for the swal.