Modify ↓
Ticket #6297 (closed enhancement: worksforme)
Keypress event's which property doesn't work as expected
| Reported by: | HTD | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | 1.4.3 |
| Component: | event | Version: | 1.4.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
Following code should report the same numbers. Depending on browser - it doesn't. Check with latest stable FireFox and Opera.
$('input').bind('keypress', function(e) {
var k1, k2; k1 = e.which; k2 = e.keyCode; if (!k2) k2 = e.charCode; document.title = k1 + ' / ' + k2;
});
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

I re-created and extended your original test and ran it against the following browsers with an output/key test of typing out 'jquery' into the input text field (Live test case: http://jsfiddle.net/addyosmani/rZ4DQ/4/)
As you can see, the same output is experienced across all browsers using jQuery 1.4.2 confirming that this is working fine. If you have additional information regarding this bug that you would like to submit, please open a new ticket.
FireFox 3.6.10: 106 / 106 113 / 113 117 / 117 101 / 101 114 / 114 121 / 121
Google Chrome 6.04: 106 / 106 113 / 113 117 / 117 101 / 101 114 / 114 121 / 121
Safari 5.02: 106 / 106 113 / 113 117 / 117 101 / 101 114 / 114 121 / 121
Opera 10.62: 106 / 106 113 / 113 117 / 117 101 / 101 114 / 114 121 / 121