Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Why can't a person use .add() instead of .append()?

Using .append() works, but I was just wondering why .add() doesn't. It seems to me that they should be equivalent. I don't understand the difference between the two.

Which language are you asking about?

1 Answer


In jQuery, add and append do very different things. The add method adds an element or a set of elements to a jQuery object so that you can perform further actions. The append method appends an element or a set of elements to an element in the document itself. Think of the add method as a way of being able to add in other elements to an object and append as a way of appending other elements to the document/page itself.

Here is the article for jQuery's add: https://api.jquery.com/add/

Here is the article for append: http://api.jquery.com/append/