Bug Tracker

Modify

Ticket #7313 (closed bug: invalid)

Opened 3 years ago

Last modified 3 years ago

Can't get input object with same id in different forms

Reported by: leizhen Owned by:
Priority: low Milestone: 1.5
Component: attributes Version: 1.4.3
Keywords: Cc:
Blocking: Blocked by:

Description

When in IE7 or IE6, I can't get a input value with same id. My sample code looks like this:

<html>

<head>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js" type="text/javascript"></script>

</head>

<body>



<script type="text/javascript">

  function getField() {

    alert($('#f1 #i1')[0])

    alert($('#f2 #i1')[0])

  }

</script>



<button type="button" onclick="getField()">get</button>



  <form id="f1" >

    <input type="text" id="i1"/>

  </form>



  <form id="f2">

    <input type="text" id="i1" />

  </form>



</body>

</html>

When click "get" button, the first alert shows ok, but the second alert shows undefined.

Change History

comment:1 Changed 3 years ago by leizhen

I create a jsFiddle:  http://jsfiddle.net/kTgCw/

comment:2 Changed 3 years ago by rwaldron

  • Status changed from new to closed
  • Resolution set to invalid
  • Component changed from unfiled to attributes

Closing; DOM elements may not share an id value in the same document.

comment:3 Changed 3 years ago by rwaldron

  • Priority changed from undecided to low

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.