There are a few ways you could do this. Here are two:

$('> td', this).css('background', '#ff0000');

or

$(this).children('td').css('background', '#ff0000');

--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Jun 29, 2009, at 3:58 PM, Coxy wrote:


$('.mainTable > tbody > tr').bind("mouseover", function(){
        // alert('hi');
        //$(this + ' > td').css('background', '#ff0000'); // Didn't work
        $(this + ' td').css('background', '#ff0000'); // Doesn't either
});

I want to highlight td's in a row when I mouse over the TR's. I set
the mouseover function using the above code. The alert works when I
mouse over the row, so I then tried to select the TD children and
change their bg but it then does nothing.

Did I use this incorrectly? I'm new to jQuery and am still getting
used to the selectors.

Thanks for any advice.


Reply via email to