Side navigation
#9689 closed bug (invalid)
Opened June 28, 2011 08:44PM UTC
Closed June 28, 2011 11:28PM UTC
keypress
Reported by: | alexander.petrichkovich@gmail.com | Owned by: | alexander.petrichkovich@gmail.com |
---|---|---|---|
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.
Attachments (0)
Change History (5)
Changed June 28, 2011 08:47PM UTC by comment:1
component: | unfiled → event |
---|---|
owner: | → alexander.petrichkovich@gmail.com |
status: | new → pending |
Changed June 28, 2011 09:20PM UTC by comment:2
Sorry, <body onkeypress="key(event)">.
I use Google Chrome 12.0.742.100 and FF5.
Changed June 28, 2011 10:21PM UTC by comment:3
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?
Changed June 28, 2011 11:00PM UTC by comment:4
Yes, you can close a bug :)
http://www.scottklarr.com/topic/126/how-to-create-ctrl-key-shortcuts-in-javascript/
Changed June 28, 2011 11:28PM UTC by comment:5
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/