On Jul 30, 2007, at 11:16 , Priest, James (NIH/NIEHS) [C] wrote:

Using the book code - I've got the background striped every other row:

        $(document).ready(
                function() {
                        // $('table#chemtable tr:odd').addClass('odd');
                        // $("#chemtable tr:even").addClass("even");
                        var rowClass = "even";
                        var rowIndex = 0;
                        $('table#chemtable tr').each(function(index) {
                        
                        if (rowIndex %2==0){
                        rowClass = (rowClass == "even" ? "odd" :
"even");
                        };
                        
                        $(this).addClass(rowClass);
                        rowIndex++;
                        });
                });

But now I'd like to add a bottom border to each 'set' (like the txt
example above) but so far my attempts haven't worked... I either get the
bottom border correct - or my striping on each 'set' gets thrown off..

How about this?

if (rowIndex % 2 == 1){
  $(this).addClass('bottom-border');
};

That will add the "bottom-border" class to the second (last) item of each group. You could insert this clause right after the existing .addClass() line.

--
Jonathan Chaffer
Technology Officer, Structure Interactive


Reply via email to