如何使用jQuery捕获IE8中的退格键? [英] How do I capture the backspace key in IE8 with jquery?
本文介绍了如何使用jQuery捕获IE8中的退格键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个通过jQuery编码的简单javascript keydown事件.该事件应仅警告向下"键.这适用于大多数键,但不适用于Internet Explorer中的Backspace键.我读到IE在keypress事件上搞砸了,但应该用于keydown和keyup事件.
I've got a simple javascript keydown event coded via jquery. The event should just alert the key that is "down." This works for most keys but not the backspace key in Internet Explorer. I read that IE messes this up on the keypress event but was supposed to work for the keydown and keyup events.
我可以通过jquery做任何事情来捕获IE中的退格键吗?我目前正在测试的IE版本是:
Is there anything I can do via jquery to capture the backspace in IE? The version of IE I'm currently testing in is:
8.0.7600.16385
8.0.7600.16385
$('.AddressField').bind("keydown", function (e) {
alert(e.keyCode);
});
推荐答案
使用哪个:
$('.AddressField').keypress(function(e){
alert(e.which);
});
这篇关于如何使用jQuery捕获IE8中的退格键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文