Ticket #7444 (closed bug: fixed)
Submitting form with "Enter" instead of button click on ie8 or ie7 triggers live submit event twice.
| Reported by: | paul@… | Owned by: | dmethvin |
|---|---|---|---|
| Priority: | high | Milestone: | 1.7 |
| Component: | event | Version: | 1.4.3 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
Run the following using ie8 and you will see the event triggered twice. Run it in any other browser and it is triggered only once.
Change History
comment:2 Changed 18 months ago by boushley
I can confirm that this is not the case for a normal submit handler and that it also persists in the GIT 0 version of jQuery.
comment:3 Changed 18 months ago by snover
- Priority changed from undecided to high
- Status changed from new to open
- Component changed from unfiled to event
- Milestone changed from 1.5 to 1.4.5
Not a regression.
comment:4 Changed 17 months ago by iliakan
That's because of a tricky IE behavior.
When a user submits by pressing enter and the form has more than one text/password input field *and* there is a visible image/submit then IE generates onclick on the submit.
Hence, the special.submit catches both click and keypress.
The patch skips keydown if it knows that IE will throw click. Fixes the issue in IE 6,7,8.
comment:8 Changed 14 months ago by xprommer
I have experienced the same problems. This happens because the browser (not only IE, i have tested IE 6-8, Firefox 3.6.8, Opera 11.01, Chrome 10, Safari 5.0.4), when user press key "Enter" in text/password input field, then the browser after keydown/keypress/keyup events send "click" event to the first submit/image button. That's why handler is called twice.
comment:9 Changed 12 months ago by anonymous
If there are any alternatives for bypassing this problem?
comment:10 Changed 10 months ago by paulrpayne
Is this ever going to be fixed on new releases, or are you waiting for ie to die? My workaround no longer works with the latest jQuery.
comment:11 Changed 8 months ago by rrafal@…
I run into the same bug. I'm using the latest version of jQuery (1.6.4) and testing with IE7 and IE8. iliakan's description of the problem is what I see too.
Please help!
comment:12 Changed 8 months ago by dmethvin
- Owner set to dmethvin
- Status changed from open to assigned
- Milestone changed from 1.next to 1.7
comment:13 Changed 8 months ago by dmethvin
- Status changed from assigned to closed
- Resolution set to fixed
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

IE 6 is also affected