Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery fadeIn() on DOM element creation?

Tags:

How do I create a DOM element in JQuery and fade it in to show up, instead of having it show up immediately?

I try this:

var myDiv = "<div>Hello!</div>" $("somePlace").after(myDiv).fadeIn('fast'); 

but this doesn't work, since the .after(myDiv) makes it popup immediately. Any solutions? Thanks!

like image 666
atp Avatar asked May 11 '09 10:05

atp


People also ask

What is the syntax of jQuery fadeIn () method?

The jQuery fadeIn() method is used to fade in a hidden element. Syntax: $(selector). fadeIn(speed,callback);

Which of the following method accepts opacity as parameter in jQuery?

The . fadeIn() method animates the opacity of the matched elements.


1 Answers

$("<div>Hello</div>").hide().appendTo("somePlace").fadeIn("fast"); 
like image 87
cletus Avatar answered Dec 02 '22 17:12

cletus