prevent repetition of the key pressed long time

1

How can you keep it from repeating the pressed key?

that is to say that when a key is typed it only has to be written only once

    
asked by hubman 21.12.2016 в 04:52
source

1 answer

5

For jquery it is worth this:

$(document).ready(function(){
  
	var pulsado = false;
  
    
	$("input").keydown(function(){
		 if(pulsado) return false;
		 pulsado = true;
    })
     
	 .keyup(function(){
		 pulsado = false;
	 });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
manten una tecla pulsada <input type="text" > 
    
answered by 21.12.2016 / 05:53
source