[jQuery] select only the father
Hi everyone,
I'm getting in trouble with this problem,
I have several divs which contains an image, and another div. we can
imagine somethin like that :
<div class="container">
<div class="img">...my image...</div>
<div class="delete">delete</div>
</div>
What I want to do is, when I put the mouse over the div Delete (and
only this one), I want to change the background of the
entire .container div.
here is my code :
$(document).ready(function(){
//action when the mouse is over :
$(".delete").mouseover(function(){ // I select the .delete divs.
//now i want to change the bg color of the
entire div, but only this div. here is my problem
$(this+':parent').css('background-color','red');
//with this selection, I select ALL the parents,but
I want only the father..
})
//action when the mouse is out
$(".thumbdelete").mouseout(function(){
$(this+':parent').css('background-color','white');
})
})
Your help would be very greatful.
Thank you very much in advance.