Bug Tracker

Modify

Ticket #5644 (closed bug: duplicate)

Opened 3 years ago

Last modified 3 years ago

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

comment:1 Changed 3 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to duplicate

This is a duplicate of #3113.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.