[jQuery] Re: Problems with selectors and this keyword

2009-06-29 Thread waseem sabjee
* *I would do it this way td { background-color:#FFF; } td.hover { background-color:#AAA; } $(function() { var tableColumn = $("td"); tableColumn.hover(function() { // on mouse over $(this).addClass("hover"); }, function() { // on mouse leave $(this).removeClass("hover"); }); }); *EXPLAN

[jQuery] Re: Problems with selectors and this keyword

2009-06-29 Thread Charlie
(this) has to stand alone, you can't use it quite the same way as parent child in your selector most common way to do it is $("this").find("td").css(..); ///looks for td's that are children of (this) or there's an abbreviated method that isn't shown in many examples $("td", this).css(

[jQuery] Re: Problems with selectors and this keyword

2009-06-29 Thread Karl Swedberg
There are a few ways you could do this. Here are two: $('> td', this).css('background', '#ff'); or $(this).children('td').css('background', '#ff'); --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Jun 29, 2009, at 3:58 PM, Coxy wrote: $('.mainTab