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

JavaScript Introduction to jQuery DOM Manipulation Adding Content to the Page

Markus Mönch
Markus Mönch
16,383 Points

Why is this done with jQuery? This can also be done with JavaScript.

I do not understand why we take the data from the form, assign it to variables and then append it to the div. this was done in a previous Javascript video with javascript. why is jquery needed for this?

3 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Stuart is right on. jQuery is a JavaScript library that is designed to make JavaScript easier to use -- Much like Sass is for CSS.
There may be a function you want to add to a website that would comprise MANY lines of pure JavaScript code, but can easily be done in one or two lines of jQuery. Honestly, you'll see much more jQuery, especially when it comes to DOM manipulation, so if Front-end Development is your goal, then jQuery will be an essential knowledge base you will need.

:dizzy:

Stuart Wright
Stuart Wright
41,120 Points

Anything that can be done using jQuery can be done using JavaScript - jQuery just saves us a lot of typing. Maybe not so much in this simple example, but once you get to more complicated stuff you'll be glad that you're not writing out all the JavaScript from scratch.

Markus Mönch
Markus Mönch
16,383 Points

hmm then i dont see much advantage of using jquery