Skip to main content

Bug Tracker

Side navigation

#4652 closed bug (duplicate)

Opened May 13, 2009 05:20AM UTC

Closed April 02, 2011 12:44AM UTC

Last modified November 03, 2012 01:04PM UTC

$("form").submit() doesn't work with named submit buttons

Reported by: ptarjan Owned by: brandon
Priority: high Milestone: 1.4
Component: event Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

If the <form> has a <input type="submit" name="abc" value="click me"/> then calling $("form").submit() won't trigger the form submission.

Example: http://paulisageek.com/tmp/jquery-form-bug.html

Tested on

OSX 10.5 FF3.0.10

WinXP SP3 FF3.0.10

Attachments (0)
Change History (19)

Changed May 14, 2009 12:19AM UTC by dmethvin comment:1

Can you change your example to include a complete head and body, and use jquery 1.3.2?

Changed July 08, 2009 12:02AM UTC by ojak comment:2

Confirmed on Safari and FF 3.5 as well.

Changed July 08, 2009 12:11AM UTC by ojak comment:3

Appears to occur only when the "name" attribute of the "input" element is set to "submit".

Example:

  <input type="submit" name="submit" value="Does not work" />

Changed July 08, 2009 12:12AM UTC by ojak comment:4

jQuery version tested: jquery-1.3.2

Changed July 24, 2009 02:44PM UTC by GreatBigBore comment:5

Same problem occurs if any "input" element has an id of "submit":

<input type="button" id="submit" value="Does not work" />

Also note that it doesn't seem to matter whether the type is "submit".

Changed August 09, 2009 02:01AM UTC by dmethvin comment:6

component: unfilledevent
owner: → brandon

This is a name ambiguity probem; see #3113. Since the workaround may be different with this one I'll leave it open.

Changed November 18, 2010 04:08AM UTC by dmethvin comment:7

status: newopen

Changed April 02, 2011 12:44AM UTC by rwaldron comment:8

priority: majorhigh
resolution: → duplicate
status: openclosed

Changed April 02, 2011 12:44AM UTC by rwaldron comment:9

Duplicate of #3685.

Changed September 09, 2011 08:55PM UTC by mthurman comment:10

I'm new to jquery so I apologize if I'm missing anything, but I don't think this bug is a duplicate of #3685. I tried putting a fiddle together to show this: http://jsfiddle.net/aX5pw/1/

Changed October 27, 2011 12:52PM UTC by anssias comment:11

I encountered this bug with jQuery 1.6.4 and Firefox 7.0.1. Just like mthurman said I don't think this ticked should closed as a duplicate.

Changed October 31, 2011 01:45PM UTC by jscheel comment:12

Still experiencing this issue. When my submit button's name attr. was "submit", $.submit() did not work. Changing the name immediately fixed the issue.

Changed November 01, 2011 02:25AM UTC by gnarf comment:13

Replying to [comment:12 jscheel]:

Still experiencing this issue. When my submit button's name attr. was "submit", $.submit() did not work. Changing the name immediately fixed the issue.

This is an epic amount of information about this on http://bugs.jquery.com/ticket/1414 and https://github.com/gnarf37/jquery/commits/bug_1414.

Suffice it to say there is nothing jQuery can do to fix it.

This is an issue that is detected by DOM Lint: http://kangax.github.com/domlint/

Changed November 01, 2011 02:30AM UTC by gnarf comment:14

Replying to [comment:11 anssias]:

I encountered this bug with jQuery 1.6.4 and Firefox 7.0.1. Just like mthurman said I don't think this ticked should closed as a duplicate.

This is most definately a duplicate of #1414 which is closed "wontfix" not because we don't want to fix it, but because we have tried an amazing amount of techniques to get around this bug and none of them solve it. The "bug" is an issue with the DOM model for forms... The

form.submit
points at the element named submit as opposed to the function which submits the form.

Changed April 30, 2012 11:16PM UTC by kobyssh comment:15

Still occurs on Chrome (18.0.1025.162 m)

Changed April 30, 2012 11:17PM UTC by kobyssh comment:16

Replying to [comment:15 kobyssh]:

Still occurs on Chrome (18.0.1025.162 m)

more details: the button's name was "submit"

Changed May 01, 2012 01:40AM UTC by rwaldron comment:17

@kobyssh the solution is to not use the word "submit" as the value of an id or name. It's not jQuery, it's the DOM.

Changed November 03, 2012 12:54PM UTC by romtek@gmail.com comment:18

In my case, no attribute's value is "submit", yet I experience this problem.

<input id="submitBtn" type="submit" value="Save" />

Changed November 03, 2012 01:04PM UTC by romtek@gmail.com comment:19

Replying to [comment:18 romtek@…]:

In my case, no attribute's value is "submit", yet I experience this problem.

except for type attribute, that is