This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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