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!
The jQuery fadeIn() method is used to fade in a hidden element. Syntax: $(selector). fadeIn(speed,callback);
The . fadeIn() method animates the opacity of the matched elements.
$("<div>Hello</div>").hide().appendTo("somePlace").fadeIn("fast");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With