Bummer! You have been redirected as the page you requested could not be found.

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

jquery

we normally write javascript in a seperate .js file and link it to the index.html...well that becomes unobtrusive JavaScript right???......why specially we use jquery rather than pure javascript to become obtrusive ?????? What i am thinking is>>>> unobtrusive------> seperate html from javascript this can be done by pure javascript.....why cant we use purejavascript?

Using jquery make your life in coding more easier than coding pure JavaScript.If you can write the 10 lines of code of pure JavaScript in 4-5 lines in jquery than why should we consider to use pure JavaScript in place of jquery. But that totally depend on you If you want to use pure JavaScript or jquery.

1 Answer

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,254 Points

Most of the time it's best to separate your JavaScript from the HTML especially when you're using lots of JS Code. But there are certain occasions when you might use an inline attribute to include your code. You can embed small snippets of JS inside script tags in the same way you'd reference an external file.

With regard to jQuery itself, I'm a fan as it has been around for a while and is one of the most stable JS libraries there is. It's up to you if you wish to use it but if you need more time to use "vanilla" or pure JS you should do that too. :-)