Bug Tracker

Opened 13 years ago

Closed 13 years ago

#5298 closed bug (invalid)

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:


.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


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?

Change History (1)

comment:1 Changed 13 years ago by scottgonzalez

Resolution: invalid
Status: newclosed

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

Note: See TracTickets for help on using tickets.