Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 763
Nick Avatar asked Feb 25 '23 16:02

Nick


2 Answers

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.

like image 102
Devin Burke Avatar answered Mar 17 '23 01:03

Devin Burke


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

like image 29
EMMERICH Avatar answered Mar 17 '23 00:03

EMMERICH