Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,880 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.