[英]Delayed number boxes in Chrome
I've noticed that the number input has a delay in firing the onChange event if you press the up/down arrow buttons inside the box. 我注意到,如果您按下框内的向上/向下箭头按钮,则数字输入会延迟触发onChange事件。
On other browsers like Mac Safari and Firefox, the onChange event is called immediately. 在Mac Safari和Firefox等其他浏览器上,onChange事件将立即被调用。
See here: https://jsfiddle.net/yyfvv0vg/ 看到这里: https : //jsfiddle.net/yyfvv0vg/
<input type="number" max="9999" min="1" onchange="change()"/>
<div></div>
function change()
{
$("div").html($("input").val());
}
Is there a way to force it to update immediately, or is it just a fact of life that I have to deal with? 有没有办法迫使它立即更新,还是我必须处理的只是生活中的事实?
Instead of onchange
event try using onmouseup
it will work. 代替onchange
事件,请尝试使用onmouseup
它将起作用。
It seems like while you put the cursor over the arrows in chrome , the data is updated until you move the cursor out of the arrows , try using the up and down keywords and you will see what I'm telling you, the data is inmediatly updated. 看起来,当您将光标放在 chrome中 的箭头上时,数据会更新,直到将光标移出箭头 ,尝试使用上下关键字,您会看到我在告诉您的信息,数据是中间的更新。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.