AnitaTang / js-hotkeys

Automatically exported from code.google.com/p/js-hotkeys
0 stars 0 forks source link

ID binding does not work in IE7 #38

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. $("#anyidhere").bind("keydown","F2",someFunction);
2. Press F2, function is not called

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
0.7.8, Windows XP, IE 7

Please provide any additional information below.
Others have reported this issue as well elsewhere

Original issue reported on code.google.com by johncken...@gmail.com on 17 Dec 2008 at 2:21

GoogleCodeExporter commented 8 years ago
I found that my bind didn't work on IE 7 too.  I was using JQuery 1.3.1 though 
(I
haven't tried 1.2.6 the officially supported version).  I found that changing
event.currentTarget to event.srcElement in the hotkeys.handler fixed it for me. 
 The
change appears to work correctly for my case on all the windows browsers I tried
(chrome, firefox, ie 7).  

I don't really understand jQuery though so I don't know whether that's of any 
use to you.

Original comment by colin.ne...@gmail.com on 3 Feb 2009 at 2:18

GoogleCodeExporter commented 8 years ago
Sorry, that didn't really work on all browsers, I was a victim of my cache.  I 
ended
up changing the line to this dodgy kludge,

        var target = hotkeys.findElement(event.currentTarget ? event.currentTarget :
event.srcElement ), 

Original comment by colin.ne...@gmail.com on 3 Feb 2009 at 4:32

GoogleCodeExporter commented 8 years ago
I also discovered another funny with IE 7 where it wasn't picking up the 
keypress if 
the event happened on a child node.  Ironically there was all the code needed 
in the 
hotkeys.findElement functiom, all I had to do to make it work was comment out 
the 
opera and safari check.  Again, I should point out that this was jquery 1.3.1.

Original comment by colin.ne...@gmail.com on 3 Feb 2009 at 10:51

GoogleCodeExporter commented 8 years ago

Original comment by Afro.Sys...@gmail.com on 3 May 2009 at 9:03

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
yes, by adding the line given above, it worked in IE7. thanks a lot. jQuery 
rocks. 

Original comment by slimsilv...@gmail.com on 28 Jul 2010 at 3:46