Modify ↓
Ticket #5644 (closed bug: duplicate)
Form attributes mishandled by attr() when fields share names with attributes
| Reported by: | kenaniah | Owned by: | |
|---|---|---|---|
| Priority: | critical | Milestone: | 1.4 |
| Component: | core | Version: | 1.3.2 |
| Keywords: | form, attr, attribute | Cc: | |
| Blocking: | Blocked by: |
Description
Consider the following form:
<form id="frm" action="search.html" method="post">
<input type="hidden" name="action" value="search" />
<input name="term" value="" />
<input type="submit" value="Search" />
</form>
One would expect $("#frm").attr('action') to return search.html. Instead, the attribute look up fails. I believe this is because document.getElementById("frm").action returns the <input> element instead of the attribute node. jQuery should instead utilize the form.attributes nodemap to access form attributes, because named form fields are promoted to direct children of the form node and effectively override the attribute nodes when attribute names and field names collide.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

This is a duplicate of #3113.