Bug Tracker

Modify

Ticket #5298 (closed bug: invalid)

Opened 4 years ago

Last modified 4 years ago

doc confusion possible new idea.

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

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?

Change History

comment:1 Changed 4 years ago by scott.gonzalez

  • Status changed from new to closed
  • Resolution set to invalid

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

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.