Hey Karl, Thanks for the reply. Actually that isn't the problem. The problem turned out to be I needed to do a removeClass on the element. Then place the new class in it. Otherwise it will append it to the already existing class.
My next problem was that I needed to remember what the class is so that on mouseout I could replace it with the original. I did this by capturing the class into a var and then doing a attr("class", class) that way it would sub the jquery object (which was the class attribute) back into the element. I can post the actual code tomorrow when I get to work if anyone is interested. It was really quite nifty and I have yet to see anyone mention this solution. Thanks Bryce On Jan 5, 8:44 pm, Karl Swedberg <[EMAIL PROTECTED]> wrote: > So, it looks like the problem you're having is that the style for the > "over" class is not overriding the "alt" class. The simple solution > would be to give a higher specificity to the "over" class's CSS rule. > Something like this, perhaps, in your stylesheet: > > .alt { background-color: #ccc; } > tr.over { background-color: #ff0; } > > With the added "tr" for the "over" class, it will successfully > override the "alt" class's background color. > > Then to apply it, use the .hover() method: > > $(".stripeMe tr").hover(function() { > $(this).addClass('over');}, function() { > > $(this).removeClass('over'); > > }); > > --Karl > _________________ > Karl Swedbergwww.englishrules.comwww.learningjquery.com > > On Jan 4, 2008, at 3:11 PM, bryce4president wrote: > > > > > I've just started working with jQuery today. One of the things I've > > been doing is using zebratables, but it has been with a javascript > > function I found that runs off the window.onload. I like the idea of > > doing this in jQuery as it is definitely faster (i tested it) and it > > is a lot cleaner and simpler. > > > Here's the problem. I do the $(".stripeMe > > tr:even").addClass("alt"); and it works just fine. Then I have > > the $(".stripeMe tr").mouseover(function(){ > > $(this).addClass("over"); > > }); > > > But instead of replacing the class that is there, it actually adds it > > to it. so then it will say <tr class="alt over"> > > > So I put this in, $(".stripeMe tr").mouseover(function(){ > > $(this).removeClass().addClass("over"); > > }); > > > Adding the removeClass() does the trick. The problem after that is > > that when I do the mouseout I have no way of knowing what the previous > > class was. So I have to do a > > $(".stripeMe tr").mouseout(function(){ > > $(this).removeClass(); > > $("stripeMe tr:even").addClass("alt"); > > }); > > > This is not good for larger tables as it can make the page seem > > glitchy when doing a mouseover. I didn't know if there was a way to > > find out in $(this) is even or not.... > > > This works the same in IE6 and FF2. Am I doing something wrong or is > > the tutorial not correct? I understand how it is theoretically > > supposed to work in the tutorial, but its not right. > > > Thanks for the help. > > Love jQuery by the way. Great library.