jquery: adding effect to changing contents of a selected element

648 views Asked by At

I am trying to add an animation effect to changing contents of a selected element.

Like here's my code to change contents of a div..

$('.message').html('The product has been deleted.');

I want to add a simple slide down effect to this process. How should I do this?

2

There are 2 answers

0
Reigel Gallarde On BEST ANSWER
$('#check').click(function() {

    $('.text').html('Here is my text.').hide().slideDown('slow'); // don't forget to hide it first....

});

demo

2
Shane Garelja On

Just call $('.message').html('The product has been deleted.').hide().slideDown(); (http://api.jquery.com/slideDown/)