Nick
Nick

Reputation: 348

Jquery multiple selector criteria with Internet Explorer

I'm trying to select items which match ".class#id", something that seems so natural as per Jquery multiple selectors, select items which match both criteria ,

but it only seems to work in firefox. Does IE just not support this?!

Specifically, I have

<div id="A" class="x">
  <div id="A" class="y">
  </div>
</div>

And I want to select $( ".y#A" )

Thanks, Nick

Upvotes: 4

Views: 1060

Answers (2)

EMMERICH
EMMERICH

Reputation: 3474

IE will complain that you have 2 elements with the same ID and cause some unusual behaviour.

Upvotes: 2

Devin Burke
Devin Burke

Reputation: 13820

You should not have multiple elements with the same identifier. Internet Explorer probably recognizes this. (Or does not recognize this, but it coincidentally has a bug that behaves as if it did, and Microsoft decided to call it a feature.)

Simply give the elements that currently have the same ids, different ids and a common class name. Then you can use$('.class.class2') and it will work in IE.

Upvotes: 6

Related Questions