Ticket #12575 (closed bug: duplicate)
native form submit event doesn't trigger $.submit event
| Reported by: | after.fallout@… | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | None |
| Component: | unfiled | Version: | 1.8.0 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
I am not sure if this is a bug in the documentation or in Core, but I cannot find anything that suggests this is by design.
jsfiddle: http://jsfiddle.net/8KNc7/5/
basically:
document.getElementById('theform').submit();
doesn't trigger
$('theform').submit();
If this is on purpose, why doesn't http://api.jquery.com/submit/ say anything that suggests this is true?
Change History
comment:1 Changed 8 months ago by rwaldron
- Status changed from new to closed
- Resolution set to notabug
comment:2 Changed 8 months ago by dmethvin
- Status changed from closed to reopened
- Resolution notabug deleted
comment:3 Changed 8 months ago by dmethvin
- Status changed from reopened to closed
- Resolution set to duplicate
Duplicate of #3115.
Just for bookeeping, this is a dup.
We can't fire jQuery events because the native DOM doesn't call its handlers when you call the DOM form.submit() method. That's the way it works. There is no event we receive that would allow us to run the attached handlers.
You can run the handlers without submitting again via .triggerHandler("submit") if you can find a place to put it.
It's not mentioned in the docs because if you use jQuery it works fine via either .trigger("submit") or the .submit() shorthand.
http://jsfiddle.net/dmethvin/4AVSv/
If you use the native DOM methods underneath us, we can't always control what they do. Not sure how many places we can put information like that.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Why would it? Those are two different APIs...
There is no documentation because we expect that users at least understand that if you're using jQuery, then you use jQuery. Right?