Instead of call the parent you can call Only that DIV of which u want to
change the background color

$(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
                       $('#container').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(){
                               $('#container
').css('background-color','white');
                       })

})

I think it might work.

Regards;

Zeeshan Ahmed Khan


On Wed, Apr 22, 2009 at 4:11 PM, gostbuster <jeremyescol...@gmail.com>wrote:

>
> 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.
>

Reply via email to