Bug Tracker

Ticket #3115 (closed bug: wontfix)

Opened 7 years ago

Last modified 3 years ago

document.formName.submit() is not caught by .submit() binding

Reported by: jstayton Owned by:
Priority: minor Milestone: 1.3
Component: event Version: 1.2.6
Keywords: Cc:
Blocking: Blocked by:


When a form is submitted via document.formName.submit(), it is not caught by the .submit() function bound to the form.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
      <title>jQuery .submit() example</title>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <script type="text/javascript" src="jquery-1.2.6.min.js"></script>
      <script type="text/javascript">
         $(document).ready(function() {
            $('form[name="testForm"]').submit(function() {

              return false;
      <form name="testForm" action="submitExample.html" method="post">
        <input type="text" name="textField" value="Press submit" />
        <input type="submit" name="submitButton" value="Submit" />
        <input type="button" name="submitButton" value="Submit with document.testForm.submit()" onclick="document.testForm.submit();" />

The 'Submit' button is properly caught (and an alert displays), but 'Submit with document.testForm.submit()' is not.

Change History

comment:1 Changed 7 years ago by flesler

  • Status changed from new to closed
  • Resolution set to wontfix
  • Component changed from core to event

I think this is how it works natively. Calling form.submit() will simply skip the handlers.

Use $(form).submit() instead.

comment:2 Changed 3 years ago by dmethvin

#12575 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.