使用e.keyCode || e.which;如何确定小写和大写之间的区别? [英] Using e.keyCode || e.which; how to determine the difference between lowercase and uppercase?
本文介绍了使用e.keyCode || e.which;如何确定小写和大写之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 e.keyCode || e.which;
确定按下了哪个键,但是我得到65只 a
和 A
为什么会发生这种情况?如何检测两者之间的差异?
I am using e.keyCode || e.which;
to determine which key was pressed, but I am getting 65 for both a
and A
why is this happening and how can I detect the difference between the two?
推荐答案
只需使用 e.which
在jquery中。它们会为所有浏览器规范化此值。
just use e.which
in jquery. They normalize this value for all browsers.
此外,您可以检查 e.shiftKey
。
这篇关于使用e.keyCode || e.which;如何确定小写和大写之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文