jQuery fallback for CSS nth-child property

Sometimes you want to apply a style to every third-item in a list.

You can do this with CSS for some browsers and in different sequences:

(NOTE the extra class “3rdChild” that we will use for fallback)

li:nth-child(3n+3), .3rdChild {
	margin-right:0!important;
}

Add this piece of jQuery to your page to ensure that IE will apply the fallback class to every third-item:

$("li:nth-child(3n+3)").addClass("3rdChild");