Skip to main content

Bug Tracker

Side navigation

#7301 closed bug (invalid)

Opened October 25, 2010 07:14AM UTC

Closed October 25, 2010 07:46AM UTC

Cannot Select by $(elem#id) if there are other element with same id in IE

Reported by: gagiksukiasyan@gmail.com Owned by:
Priority: undecided Milestone: 1.5
Component: unfiled Version: 1.4.3
Keywords: Cc:
Blocked by: Blocking:
Description

Suppose we have 2 elements "a" and "div" and both have id "myId",

and when i'm trying to selec div as follow:

alert($("div#myID").html())

it alerts "null", but when i'm changing id of "a" element every thing is ok.

I saw this problem in IE8

Attachments (0)
Change History (1)

Changed October 25, 2010 07:46AM UTC by SlexAxton comment:1

resolution: → invalid
status: newclosed

jQuery does not support invalid html. By definition, an id is unique. Having duplicate id's is also against the html spec (all versions).

You should use classes, more than likely.