Hi Mang, For your reading pleasure: http://jqueryminute.com/blog/jquery-parent-vs-parents/
Cheers, -Jonathan On 1/23/08, Mang <[EMAIL PROTECTED]> wrote: > > > Thanks, worked great - I can tell I've got some learnin' to do. I > don't understand how you knew to go from what I had to what you gave > me! > > Experience i guess :) > > Thanks! > > > > On Jan 23, 4:29 pm, "Jonathan Sharp" <[EMAIL PROTECTED]> wrote: > > Try: $(this).parents('tr:eq(0)').css('background-color', 'white'); > > > > Cheers, > > -Jonathan > > > > On 1/23/08, Mang <[EMAIL PROTECTED]> wrote: > > > > > > > > > I have a fairly simple app: > > > > > <table> > > > <thead> > > > <th>... > > > </thead> > > > <tbody> > > > <tr><td><img src="/images/deactivate.gif" > class="active_toggle"></td></ > > > tr> > > > <tr><td><img src="/image/deactivate.gif" class="active_toggle"></td></ > > > tr> > > > <tr><td><img src="/image/deactivate.gif" class="active_toggle"></td></ > > > tr> > > > </tbody> > > > </table> > > > > > then the following jquery toggles the src of the images back and forth > > > > > $("img.active_toggle").toggle(function(e){ > > > // alert('change to reactivate'); > > > $(this).attr("src","images/btnReactivate.gif") > > > }, function(e) { > > > // alert('change to deactivate'); > > > $(this).attr("src","images/btnDeactivate.gif") > > > // hide a row after acknowledgement > > > > > }); > > > > > What I would like to do now is add some jquery that changes the > > > background-color of the row containing the image that was clicked. My > > > thought was to use parent/parents, but nothing seems to be working: > > > > > $("img.active_toggle").toggle(function(e){ > > > $(this).attr("src","images/btnReactivate.gif") > > > $(this).parent('tr').css("background-color","red") > > > return false; > > > }, function(e) { > > > $(this).attr("src","images/btnDeactivate.gif") > > > $(this).parent('tr').css("background-color","white") > > > }); > > > > > Clicking the image toggles the src just fine, but the tr color never > > > changes. > > > > > thx! >