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
Maya Benari
750 PointsLearn jQuery or stick with vanilla JS?
I'm just starting out the JavaScript courses (likely will work my way through the JS track), although I have been getting by with it as a web designer for many years.
Should I learn jQuery or stick with vanilla JS? There seems to be movement against using jQuery (http://youmightnotneedjquery.com/, http://lea.verou.me/2015/04/jquery-considered-harmful/) so I want to make sure I learn JS the right way. My worry is that taking that course will make me rely on jQuery as a crutch rather than thinking of how to do it in pure JavaScript. There are probably more downsides to it too, just type "you don't need jquery" into Google.
3 Answers
Kevin Korte
28,149 PointsjQuery has been abused by inexperienced developers....and....the anti jquery moment is overhyped by blog authors looking to capitalize on a little extra adsense revenue by throwing out a clickbaity "shock" title.
You should learn both, you should learn why you're using jquery, so that way it's not a crutch. jQuery isn't that bad, plus if you pull jquery from google's cdn, there is a very high probability that the user already has jQuery cached in their browser from another site, so the cost of jquery on yours would/could me almost nothing.
That's my $.02. Just know why you're using whatever tool your using, and you should be fine to make the right decsion for you and your situation.
Bryn Price
Full Stack JavaScript Techdegree Student 7,253 PointsI would echo Kevin's advice. Learning vanilla is good and I think beneficial to using JQuery anyway, as well as any other libraries you stumble upon. Plus may help for good coding habits.
I have used both and personally, I love JQuery a lot but I can see how people can develop bad habits or use it when it's not necessary. Though I do not believe we should reject something because people are using it improperly, just encourage people not to do it and push good coding habits.
As the site youmightnotneedjquery.com/ states themselves:
"jQuery and its cousins are great, and by all means use them if it makes it easier to develop your application.
If you're developing a library on the other hand, please take a moment to consider if you actually need jQuery as a dependency. Maybe you can include a few lines of utility code, and forgo the requirement. If you're only targeting more modern browsers, you might not need anything more than what the browser ships with.
At the very least, make sure you know what jQuery is doing for you, and what it's not. Some developers believe that jQuery is protecting us from a great demon of browser incompatibility when, in truth, post-IE8, browsers are pretty easy to deal with on their own."
So it's not suggesting that JQuery is bad to use, but to make sure you're using it for the right reasons. So as said, learning both avoids it being a crutch at least.
But I have been recently using it for a project at work, (although not a programming job, but I made a suggestion, people liked it, now I am coding it to their specifications) and it is proving to be very useful to me. I am thinking if I did it vanilla, it would be going the long way round for some things I wanted to do and would take me longer to develop and given my time constraint, JQuery has been brilliant. But I would also class myself as inexperienced, as I am working still through the Tech Degree anyway.
Andrew Chalkley
Treehouse Guest TeacherLearn both.
There are pros and cons for learning either way. Here's a brief pro and con for each.
JS first then jQuery : Pro: You will have an idea of how jQuery works. Con: Code is verbose and harder to follow jQuery first then JS DOM : Pro: Simpler API at first then understanding the magic of jQuery with Vanilla. Con: You don't know where jQuery ends and JavaScript starts.