Opened 12 years ago
Closed 12 years ago
#9689 closed bug (invalid)
keypress
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | 1.next |
Component: | event | Version: | 1.6.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
$(document.body) .bind('keypress', function(event) {
console.log(event);
});
and
$(document.body) .keypress(function(event) {
console.log(event);
});
don't work. Only <body onkeypressed="..."> works correctly.
Change History (5)
comment:1 Changed 12 years ago by
Component: | unfiled → event |
---|---|
Owner: | set to [email protected]… |
Status: | new → pending |
comment:2 Changed 12 years ago by
Sorry, <body onkeypress="key(event)">. I use Google Chrome 12.0.742.100 and FF5.
comment:3 Changed 12 years ago by
Fixed my code in this way:
$(document).keypress(function(event) { if (event.ctrlKey) { ctrl+c if (event.charCode == 99) {
But have a problem with 'ctrl+c' in Google Chrome. Can you tell me is it possible to get 'ctrl+c' work in Google Chrome?
comment:4 Changed 12 years ago by
Yes, you can close a bug :)
http://www.scottklarr.com/topic/126/how-to-create-ctrl-key-shortcuts-in-javascript/
comment:5 Changed 12 years ago by
Resolution: | → invalid |
---|---|
Status: | pending → closed |
onkeypressed
is not a valid key event name.Which browser are you experiencing this issue in? This works for me:
http://jsfiddle.net/rwaldron/WXMca/