Satch3000
Satch3000

Reputation: 49384

JQuery Mouseover and mouseout text on div

I am trying to have some text added to a Div where I can add some text if the image is hovered and disappear when mouse is out.

I'm trying this:

<script>
$('#image1').mouseover(function() {
 $('#panel').append('<div>This image is very nice.</div>');
});
</script>

Upvotes: 1

Views: 1575

Answers (1)

Sergio Tulentsev
Sergio Tulentsev

Reputation: 230316

You should try this:

$('#image1').hover(function() {
    $('#panel').append('<div>This image is very nice.</div>');
}, function() {
    $('#panel').empty();
});

Upvotes: 3

Related Questions