Opened 12 years ago
Closed 12 years ago
#7301 closed bug (invalid)
Cannot Select by $(elem#id) if there are other element with same id in IE
Reported by: | 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
Note: See
TracTickets for help on using
tickets.
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.