Javascript – Using fadein and append


I am loading JSON data to my page and using appendTo() but I am trying to fade in my results, any ideas?


I saw that there is a difference between append and appendTo, on the documents.

I tried this as well:


I got it, the above did the trick!

But I get "undefined" as one of my JSON values.

Best Solution

If you hide the content before you append it and chain the fadeIn method to that, you should get the effect that you're looking for.

// Create the DOM elements
// Sets the style of the elements to "display:none"
// Appends the hidden elements to the "posts" element
// Fades the new content into view