Skip to main content

Bug Tracker

Side navigation

#5298 closed bug (invalid)

Opened September 26, 2009 05:47PM UTC

Closed September 27, 2009 01:06AM UTC

doc confusion possible new idea.

Reported by: Evan Carroll Owned by:
Priority: minor Milestone: 1.4
Component: unfiled Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

.submit(fn) is confusing

12:40 < EvanCarroll> i think i found a bug.

12:40 < EvanCarroll> if the <button type="submit"...>, and you .submit(fn) it, the fn is never called.

12:40 < EvanCarroll> however, if you .click(fn) it, it works

12:40 < EvanCarroll> any ideas or advice?

12:42 < temp01> EvanCarroll: submit event fires on the form not on the button

12:43 < temp01> so $('#myform').submit(function(){ ... }) - will run function whenever the form submits (Enter key/button

click/etc)

12:43 < EvanCarroll> wow, that is amazingly not-intuitive. (for me0

12:43 < EvanCarroll> $(":submit").submit( fn )

I was trying $(":submit").submit( fn ) it turns out this is a no-go. as submit as an event can only be attached to a form, but there is no fatal error when attaching to a button?

Maybe attaching submit to a button should attach it to the form, and with a conditional on only that button?

Attachments (0)
Change History (1)

Changed September 27, 2009 01:06AM UTC by scottgonzalez comment:1

resolution: → invalid
status: newclosed

This actually has nothing to do with how jQuery is implemented. This is how the DOM works.