Treat each group of li's independantly?
Hi, friends,
in this code I may have serveral ul's
How can I apply this so that it treats each group of li's independantly? ie the numbering starts fresh for each ul group?
- <script type="text/javascript">
- (function($){
- $(document).ready(function() {
- $("ul > li").each(function(i) {
- if (i % 2 == 1)
- {
- $(this).addClass("odd");
- }
- else
- {
- $(this).addClass("even");
- }
- });
- });
- })(jQuery);
- </script>