Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created April 28, 2020 22:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/a673b7503f87c89812ec765ca0122f43 to your computer and use it in GitHub Desktop.
Save parzibyte/a673b7503f87c89812ec765ca0122f43 to your computer and use it in GitHub Desktop.
const $nombre = document.querySelector("#nombre");
// Escuchamos el keydown y prevenimos el evento
$nombre.addEventListener("keydown", (evento) => {
if (evento.key == "Enter") {
// Prevenir
evento.preventDefault();
return false;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment