Modify ↓
Ticket #6092 (closed bug: wontfix)
IE7/8 Bug with id based searching
| Reported by: | Cameron | Owned by: | |
|---|---|---|---|
| Priority: | Milestone: | 1.4.1 | |
| Component: | core | Version: | 1.4.1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
<div id="abc">
<div id="ghi">
test 1
</div> <div id="def">
test 2
</div>
</div>
<div id="jkl">
<div id="def">
test 3
</div>
</div>
<script language="JavaScript">
$('#abc #def').css("border","3px solid red"); $('#jkl #def').css("color", "green");
</script>
The 2nd line of the script will not function and returns a null. The last version that works properly is 1.2.6 I have tried all versions from 1.2.6 up through 1.4.1 and all are affected.
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.

You really shouldn't be using multiple identical IDs in a document - I recommend using classnames instead as that will avoid any potential collisions. IDs are meant to be unique across the entire document.