A Pen by Yerlin Matu on CodePen.
Created
June 26, 2017 04:45
-
-
Save YerlinMatu/33a65a3d80edc18426562d20e2d3b316 to your computer and use it in GitHub Desktop.
Evitar repetir teclas
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
<h1>Escribir una sola tecla</h1> | |
<h3>Detector de tecla presionada</h3> | |
<input type="text" placeholder="Escribe una sola letra" id="texto"/> |
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
let texto = document.getElementById('texto'); | |
texto.addEventListener('keydown', (tecla)=>{ | |
if(tecla.repeat){ | |
tecla.preventDefault(); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Evitar repetir letras al dejar pulsado una tecla.