[英]How can I get delay from my Keypress event?
I need to make a delay for my keypress event because it only takes the second number that I press.我需要延迟我的按键事件,因为它只需要我按下的第二个数字。
$('#cuota').on('keypress', function(event) {
var precio_origen = $('#cuota).val();
console.log(precio_origen);
});
The keypress
event is fired when the input control's value has not been updated yet.当输入控件的值尚未更新时,将触发
keypress
事件。 If you want to get an event when that value is already updated, use the input
event.如果您想在该值已更新时获取事件,请使用
input
事件。
$("#cuota").on("input", function () { console.log($(this).val()); });
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> Input: <input id="cuota">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.