tags:

views:

33

answers:

2

HI,

I am trying to hide a child div when you hover on the parent div outside the child, any ideas how I can do this using jquery?

At the moment using the hover function, it hides the child div when I hover anywhere over the parent, including when over the child.

alt text

+1  A: 

You can go about something like this:

$('div').hover(function(){
  if ($(this).attr('id') === 'parentdiv') {
    $('div#childdiv').hide();
  }
});
Sarfraz
Hey sAc, thanks for the quick answer, but it doesn't seme to work for me... i've commented my code above...
eric
+1  A: 
$("div#parentdiv").hover(function () {
  $("div:child").hide("slow", function () {
    // use callee so don't have to name the function
    $(this).prev().hide("slow", arguments.callee); 
  });
});