Bug Tracker

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#10909 closed bug (duplicate)

.submit() fails when field named "submit" exists

Reported by: tiago.carvalho@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:

Description

Found a problem while using a form field named "submit"

<iframe name="goto"></iframe>
<form id="myform">
  <input type="text" name="submit" value="1" />
</form>
<script>
$(function() {
  $("#myform").submit(); /* this FAILS */
});
</script>

Change History (4)

comment:1 Changed 7 years ago by tiago.carvalho@…

Found a problem while using a form field named "submit"

test case: http://jsfiddle.net/mWn4D/1/

comment:2 Changed 7 years ago by mofle

This is not a bug. See the docs: http://api.jquery.com/submit/

Forms and their child elements should not use input names or ids that conflict with properties of a form, such as submit, length, or method. Name conflicts can cause confusing failures. For a complete list of rules and to check your markup for these problems, see DOMLint.

comment:3 Changed 7 years ago by dmethvin

Resolution: duplicate
Status: newclosed

comment:4 Changed 7 years ago by dmethvin

Duplicate of #1414.

Note: See TracTickets for help on using tickets.