Skip to main content

Bug Tracker

Side navigation

#7313 closed bug (invalid)

Opened October 26, 2010 10:18AM UTC

Closed October 26, 2010 01:17PM UTC

Last modified October 26, 2010 01:19PM UTC

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:
Blocked by: Blocking:

When in IE7 or IE6, I can't get a input value with same id.

My sample code looks like this:



<script src="" type="text/javascript"></script>



<script type="text/javascript">

  function getField() {

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

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



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

  <form id="f1" >

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


  <form id="f2">

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




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

Attachments (0)
Change History (3)

Changed October 26, 2010 10:26AM UTC by leizhen comment:1

I create a jsFiddle:

Changed October 26, 2010 01:17PM UTC by rwaldron comment:2

component: unfiledattributes
resolution: → invalid
status: newclosed

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

Changed October 26, 2010 01:19PM UTC by rwaldron comment:3

priority: undecidedlow