Bug Tracker

Opened 9 years ago

Closed 9 years ago

#7301 closed bug (invalid)

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

Reported by: gagiksukiasyan@… 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

Change History (1)

comment:1 Changed 9 years ago by SlexAxton

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.

Note: See TracTickets for help on using tickets.