I'm currently using this code to add a class of "last" to the last list item in any list but what I am now trying to do is to add the class of "last" to every third div block that I have in a containing div. For example I have a grid of 3 by 3 and so the last div in each of those three rows I would like to have zero right margin.
The code I used for the list item was this:
$(document).ready(function() {
$("li:last-child").addClass("last");
});
But I've not idea where to start with the code for every third div!