Results 1 to 2 of 2
Threaded View
-
December 15th, 2011, 08:37 PM #18Registered User
postsCounting list items in each TD with jQuery?
Within each TD of the retailers div there is a UL, what I am trying to do is determine how many list items exist in each individual TD, if there is more than 1 list item I need to style it a specific way, as you can see below, however, when trying this code it applies the CSS to every LI, I am not sure where I am going wrong?
Code:$('#retailers tr').each(function() { $.each(this.cells, function() { var countLI = $("ul.links").children().length; if(countLI + ":gt(1)") { $("ul.links li").css("background-color", "yellow"); } }); });

Reply With Quote

Bookmarks