I am using this code
$('.list-item:nth-child(5n)').after('<div class="clear"><img src="http://domain.com/image.jpg" width="780" height="80" alt="banner" /></div>')
This works fine in Firefox and Chrome but not working in IE8, IE9...
I am using this code
$('.list-item:nth-child(5n)').after('<div class="clear"><img src="http://domain.com/image.jpg" width="780" height="80" alt="banner" /></div>')
This works fine in Firefox and Chrome but not working in IE8, IE9...
nth-child
is not supported in IE 6-8. IE9 has support for it. See here.See this question for a possible workaround.
There's actually an script that you can upload in your js folder and add some conditionals in your header and nth-child will work in IE 6, 7 and 8. you can learn more here and if you need to use rounded corners you will need to install this other script called curvycorners.js They are really time saving. Good Luck
The jQuery nth-child selector doesn't work in some corner cases that involve complex selectors in IE8.
Following needed to be modified in IE8.
NOTE:nth-child is 1-index based. eq() is 0-index based.
jQuery handles
nth-child
in the absense of native browser support. It works just fine in IE7, 8 and 9+.Fiddle: http://jsfiddle.net/jonathansampson/Y3MP4/
It sounds like there's something else amiss. Your code should work even in IE6 - though IE<9 doesn't natively support nth-child, jQuery's selector engine (Sizzle) implicitly handles it for you.
Give this code a go:
Do you see the "Clear!" remarks? Even in IE6, you should...