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 trialVenkiteswaran Subramanian
7,643 PointsWhen to choose jquery over javascript?
Whatever learned till now can be achieved using javascript as well(DOM traversing, manipulation, events) without more lines of code. How to decide whether to use jquery over javascript?
1 Answer
Steven Parker
231,275 PointsSome reasons you might want to use JQuery:
- you want more compact code (for example:
$("#test")
vs.getElementById("test")
) - you find the JQuery syntax easier to read and maintain
- you use AJAX and want to save lines of code.
- you want to use selectors unique to JQuery (such as ":hidden")
- you want to use unique facilites in JQuery (such as
.animate()
or.slideUp()
) - you want your code to have wider cross-version and/or cross-platform compatibility