Side navigation
#4371 closed bug (invalid)
Opened March 18, 2009 08:06AM UTC
Closed March 18, 2009 01:51PM UTC
Event handling discrepancies for IE 7.0
| Reported by: | yoichi | Owned by: | brandon |
|---|---|---|---|
| Priority: | major | Milestone: | 1.3.2 |
| Component: | event | Version: | 1.3.2 |
| Keywords: | keydown | Cc: | |
| Blocked by: | Blocking: |
Description
While all browsers will handle this:
$(document).ready(function() {
$(window).keydown(function() { alert('OK'); });
});
IE7 requires it to look like
$(document).ready(function() {
$(document).keydown(function() { alert('OK'); });
});
(notice 'document' instead of 'window' inside the first handler.) The same *probably* applies to 'keyup' and 'keypress'.
Attachments (0)
Change History (2)
Changed March 18, 2009 01:48PM UTC by comment:1
| description: | While all browsers will handle this: \ \ $(document).ready(function() { \ $(window).keydown(function() { alert('OK'); }); \ }); \ \ IE7 requires it to look like \ \ $(document).ready(function() { \ $(document).keydown(function() { alert('OK'); }); \ }); \ \ (notice 'document' instead of 'window' inside the first handler.) The same *probably* applies to 'keyup' and 'keypress'. → While all browsers will handle this: \ {{{ \ $(document).ready(function() { \ $(window).keydown(function() { alert('OK'); }); \ }); \ }}} \ IE7 requires it to look like \ {{{ \ $(document).ready(function() { \ $(document).keydown(function() { alert('OK'); }); \ }); \ }}} \ \ (notice 'document' instead of 'window' inside the first handler.) The same *probably* applies to 'keyup' and 'keypress'. |
|---|
Changed March 18, 2009 01:51PM UTC by comment:2
| resolution: | → invalid |
|---|---|
| status: | new → closed |
The window object in IE does not have key events. http://msdn.microsoft.com/en-us/library/ms535873(VS.85).aspx#
The correct way to bind those events is to bind to the document.