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

Pure javascript vs jQuery?

I've noticed that Tree house's Js lessons don't really teach you how to interact with the DOM the same way their jQuery lessons do. For example I haven't seen any "getElementByID" or anything like that. Does that mean that they recommend using jQuery more than pure Js? Or should I be using pure Js more than jQuery on real projects?

3 Answers

I think the main advantage of Jquery is cross browser compatibility. I think knowing as much as possible about Javascript is always a good thing, especially considering all the new frameworks gaining popularity. I recommend checking out "Professional Javascript for Web Developers" by Nicholas Zakas for the complete view.

+1 for "knowing as much as possible about Javascript is always a good thing"

> I've noticed that Tree house's Js lessons don't really teach you how to interact with the DOM the same way their jQuery lessons do.

It's a separation of concerns. For instance before you get to jQuery you need to know about variables, conditionals, loops and a bunch of other fundamental JavaScript topics. It's easier to teach if you teach someone to use JavaScript and (if I recall correctly) you only interact with the DOM incidentally to show other features in the JavaScript Foundations course.

> Does that mean that they recommend using jQuery more than pure Js?

In most cases it's easier to use jQuery when interacting with the DOM yes.

I try to jQuery over pure JS anymore because it just works. Can create code with more complexity easier and faster then with pure Js.