Sri*_*vas 5 javascript jquery keycode keypress submit
事件keypress13和10不工作在iPhone Safari,android firefox但使用Android默认浏览器.
我有一个jsp页面,其中有一个表单,该表单以数字作为输入,并通过将这些数字除以此输入来更改同一页面中其他div元素的值.
我正在使用keypressjQuery的功能,并使用键码10和13进行测试.它适用于所有桌面浏览器,但GO按钮不会触发智能手机上的safari和firefox.请告诉我如何解决这个问题?
这是我使用的部分代码:
$('.number').keypress(function(e) {
if(e.keyCode == 10 || e.keyCode == 13 ) {
$('#1').html((textreplace/input).toFixed(0)+'g');
$('#2').html((textreplace2/input).toFixed(0)+'%');
$('#3').html((textreplace3/input).toFixed(0)+'g');
...
..
}
}
Run Code Online (Sandbox Code Playgroud)
".number"是输入表单中使用的类名称,其类型为"text".所以,基本上我根本不使用提交.
| 归档时间: |
|
| 查看次数: |
6535 次 |
| 最近记录: |