Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created December 16, 2019 18:56
Embed
What would you like to do?
Swal
.fire({
title: "Tu nombre",
input: "text",
showCancelButton: true,
confirmButtonText: "Guardar",
cancelButtonText: "Cancelar",
inputValidator: nombre => {
// Si el valor es válido, debes regresar undefined. Si no, una cadena
if (!nombre) {
return "Por favor escribe tu nombre";
} else {
return undefined;
}
}
})
.then(resultado => {
if (resultado.value) {
let nombre = resultado.value;
console.log("Hola, " + nombre);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment