Use e.which for Keyboard Events

I did not realize that there are browser compatitbility issues in dealing with keyboard events (e.keyCode and e.charCode). So jQuery handles it with e.which. Here's a snippet from their documentation:

The event.which property normalizes event.keyCode and event.charCode. It is recommended to watch event.which for keyboard key input.

event.which also normalizes button presses (mousedown and mouseupevents), reporting 1 for left button, 2 for middle, and 3 for right. Use event.which instead of event.button.


Add a Comment...



Please let me know if you're looking for a writer for your weblog. You have some really great posts and I think I would be a good asset. If you ever want to take some of the load off, I'd love to write some content for your blog in exchange for a link back to mine. Please send me an email if interested. Many thanks! - 9/30/2016

I'm curious to find out what blog platform you're utilizing? I'm experiencing some small security problems with my latest website and I would personally like to find some thing safeguarded. Do you have any solutions? - 9/28/2016

Hi there, just became aware about your blog site through Google, and found that it can be really informative. I am just planning to be cautious about brussels. I'll be grateful when you continue this later on. A lot of men and women will be benefited from your writing. Cheers! - 9/25/2016

I'm extremely impressed together with your writing skills along with using the layout on your weblog. Could this be a paid theme or would you customize it yourself? In any event keep up the nice quality writing, it really is rare to view a great blog similar to this one today. - 9/24/2016

Hiya! I know this is kinda off topic nevertheless I'd figured I'd ask. Would you be interested in exchanging links or maybe guest writing a blog post or vice-versa? My website goes over a lot of the same subjects as yours and I feel we could greatly benefit from each other. If you happen to be interested feel free to shoot me an e-mail. I look forward to hearing from you! Awesome blog by the way! - 9/11/2016

Howdy, I actually do think your online site might actually be having browser compatibility problems. When I evaluate your site in Safari, it appears fine however, if opening in IE, it has some overlapping issues. I recently planned to provide you with a quick heads up! Adding to that, wonderful blog! - 8/30/2016

marylandsubaruclub juiciooral cursosiclatam femaclaims klongchan casa-d-angelo projecthomelessconnectbutte vbex universalloves fixerp - 5/08/2017

Very quickly this webpage will be famous amid all blog viewers, as a result of it's fastidious articles - 12/16/2016

It's amazing to pay a quick visit this web page and reading the views of all mates regarding this paragraph, while I am also eager of getting know-how. - 12/01/2016

You've made some really good points there. I looked online to learn more about the issue and discovered most individuals will go together with your views on this site. - 11/23/2016

Hello there! This is my 1st comment here so I just wanted to give a quick shout out aand tell yyou I genuinely enjoy reading through your posts. Can youu recommend any otherr blogs/websites/forums that deal with the same topics? Many thanks! - 10/16/2016