Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery :not(:first) not working in IE8, but does in FF and Chrome

$('.divMapTab:not(:first)').each(...

I've got 2 divs on my page, both with class of divMapTab. In FF and Chrome, the code above only selects the 2nd instance of divMapTab, but in IE it selects them both.

Am I missing a subtlety in how the :not or :first keywords work?

like image 467
Matt Dawdy Avatar asked May 18 '10 16:05

Matt Dawdy


2 Answers

IE does not support the CSS :not selector which this method relies on. Instead try:

$('.divMapTab').not().first().each(...
like image 83
Bradley Mountford Avatar answered Nov 02 '22 01:11

Bradley Mountford


The ".not().first().each(" solution did not work in my case.

I had to qualify more my ":first" selector repeating the class name ".panneau":

$(".panneau:not(.panneau:first)").hide();

It's a behavior that won't be fixed by jQuery.

like image 44
François Breton Avatar answered Nov 02 '22 03:11

François Breton