Andrew
Andrew

Reputation: 12412

Hide div when a different div isn't being hovered over?

My code:

$(document).ready(function() {
$('.tags').hover(function() {
    var id = this.id;
    $.post("tag_process.php", { tag: id }, function(data) {
        $("#entries").html(data);
        });
  });
});

I want #entries to hide(); when .tags isn't being hovered over. Is that possible?

Upvotes: 0

Views: 43

Answers (1)

PetersenDidIt
PetersenDidIt

Reputation: 25620

Try this out:

$(document).ready(function() {
$('.tags').hover(function() {
    var id = this.id;
    $.post("tag_process.php", { tag: id }, function(data) {
        $("#entries").html(data).show();
        });
  },function(){
    $('#entries').hide();
  });
});

Upvotes: 2

Related Questions