I have a line div. You must add a clear div after every fourth element. 4 to the line.
I am using jQuery('.product:nth-of-type(4n+2)').after("<div class='clear'></div>");
right now, but it does not support IE8. And since we are using jQuery, selectivizrs fix will not work in this case.
I also tried
addDynamicRow = function() { var divs = $(".product-section > .product"); for(var i = 0; i < divs.length; i+=4) { divs.slice(i, i+4).wrapAll("<div class='row'></div>"); } $('.row').after("<div class='clear'></div>") } addDynamicRow();
But it captures all commodity divs in other packages of the product section and puts them in groups of four no matter where they are.
Does anyone know a job? I could not find a solution.
Thanks!
Update 1/15/13: jQuery 1.9 now supports the following CSS3 selectors in all browsers, up to IE6 :: nth-last-child ,: nth-of-type ,: nth-last-of-type ,: first-of- type ,: last-of-type ,: only-of-type ,: target ,: root and: lang.
source share