如何处理移动模式下的按键事件。当按键输入类型= "text" ..它在桌面模式下正常工作(通过键盘按键)



如何在javascript的按键事件上处理移动模式下车辆编号的验证..无法正常工作。

<input type="text" onkeypress="func1()" id="vname">
<script>
function func1()
{
alert('hello');
}
</script>
<input type="text" onkeypress="func1()" id="vname">

在移动设备中按键 id="vname" 时不会提醒消息,但在桌面模式下工作正常...我也尝试了jQuery移动版的tap((,但是当通过输入标签中的值触摸键盘时,它也不起作用

众所周知,keypress在移动环境中很麻烦。你应该使用onkeydown

<input type="text" onkeydown="func1()" id="vname">
<script>
function func1()
{
alert('hello');
}
</script>
<input type="text" onkeydown="func1()" id="vname">

最新更新