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 Traversing and Manipulating the DOM with JavaScript Perform: Traversing Elements with querySelector

Kenn Hyatt
Kenn Hyatt
9,683 Points

What does button.edit mean on line 61 of the video?

I've made sense of everything else except this portion (button.edit) that is passed in on line 61.

Can someone elucidate what is being passed into that method?

At 4:00 in the video he roughly explains/uses CSS selectors. When you pass it "button.edit" it is selecting all button elements on the page with the class edit. He then stores it in a variable to be referenced later.

If you are still having trouble understanding what is going on in these videos let me know and I will try my best to explain in more detail!

Hope this helped! Keep up the great work!

Please check out: https://developer.mozilla.org/en-US/docs/Web/API/document.querySelector

If I didn't explain it correctly please let me know as I wish to understand just as much as everyone else!! Kenn Hyatt

Kenn Hyatt
Kenn Hyatt
9,683 Points

Of Course! when you said "button.edit" it is selecting all button elements on the page, it clicked! What is passed into that querySelector method is what the javascript file needs to look for to bind to taskListItem and then pass into the editButton var

When he said uses the CSS Jquery selector method is what threw me. Where can I read more about this CSS Jquery selector method?

Kenn Hyatt
Kenn Hyatt
9,683 Points

Also Andrew, if you want to submit your comment as a an answer, I would be happy to set your answer as best. Definitely best answer material here

3 Answers

Kenn Hyatt
Kenn Hyatt
9,683 Points

As submitted by Andrew:

At 4:00 in the video he roughly explains/uses CSS selectors. When you pass it "button.edit" it is selecting all button elements on the page with the class edit. He then stores it in a variable to be referenced later.

If you are still having trouble understanding what is going on in these videos let me know and I will try my best to explain in more detail!

Hope this helped! Keep up the great work!

Please check out: https://developer.mozilla.org/en-US/docs/Web/API/document.querySelector

If I didn't explain it correctly please let me know as I wish to understand just as much as everyone else!!

Kyle Daugherty
Kyle Daugherty
16,441 Points

It's selecting a button element with the class name of "edit"

At 4:00 in the video he roughly explains/uses CSS selectors. When you pass it "button.edit" it is selecting all button elements on the page with the class edit. He then stores it in a variable to be referenced later.

If you are still having trouble understanding what is going on in these videos let me know and I will try my best to explain in more detail!

Hope this helped! Keep up the great work!

Please check out: https://developer.mozilla.org/en-US/docs/Web/API/document.querySelector

If I didn't explain it correctly please let me know as I wish to understand just as much as everyone else!! Kenn Hyatt

Edit: Double posted to add as an answer