#4652 closed bug (duplicate)
$("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
Change History (19)
comment:1 Changed 14 years ago by
comment:3 Changed 14 years ago by
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" />
comment:5 Changed 14 years ago by
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".
comment:6 Changed 14 years ago by
Component: | unfilled → event |
---|---|
Owner: | set to brandon |
This is a name ambiguity probem; see #3113. Since the workaround may be different with this one I'll leave it open.
comment:7 Changed 13 years ago by
Status: | new → open |
---|
comment:8 Changed 12 years ago by
Priority: | major → high |
---|---|
Resolution: | → duplicate |
Status: | open → closed |
comment:10 Changed 12 years ago by
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/
comment:11 follow-up: 14 Changed 12 years ago by
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.
comment:12 follow-up: 13 Changed 12 years ago by
Still experiencing this issue. When my submit button's name attr. was "submit", $.submit() did not work. Changing the name immediately fixed the issue.
comment:13 Changed 12 years ago by
Replying to 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/
comment:14 Changed 12 years ago by
Replying to 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.
comment:16 Changed 11 years ago by
Replying to kobyssh:
Still occurs on Chrome (18.0.1025.162 m)
more details: the button's name was "submit"
comment:17 Changed 11 years ago by
@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.
comment:18 follow-up: 19 Changed 11 years ago by
In my case, no attribute's value is "submit", yet I experience this problem.
<input id="submitBtn" type="submit" value="Save" />
comment:19 Changed 11 years ago by
Replying to romtek@…:
In my case, no attribute's value is "submit", yet I experience this problem.
except for type attribute, that is
Can you change your example to include a complete head and body, and use jquery 1.3.2?