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 Interactive Web Pages with JavaScript Selecting Elements and Adding Events with JavaScript Perform: Selecting Elements

Yijiao Wang
Yijiao Wang
1,793 Points

To what extent can we combine JQuery and Javascript in one document?

var addButton=getElementByTagName('button')[0]; addButton.click(function(){ var $newTask=$('#new-task').val(); $('#incomplete-tasks').append($newTask); });

Above is my first attempt for this project. I've no idea whether or not are we allowed to use Jquery and Javascript mixed together? I know that Jquery is basically a library for Javascript but to what extent can we combine those together? Is it ok to use it like in my code?

Nursultan Bolatbayev
Nursultan Bolatbayev
16,774 Points

I will just add some comments to Adam's answer. In this course Andrew tries to implement TODO app through pure javascript without JQuery. But of course it can be implemented with JQuery either and it is much easier.

1 Answer

Adam Pengh
Adam Pengh
29,881 Points

Yijiao Wang,

You can use plain JavaScript at any time, since all modern web browsers have a JavaScript interpreter. However, in order to use jQuery, you need to include the jQuery library. You can still use JavaScript along with jQuery. You're not restricted to only using jQuery once you include the jQuery library.