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 CSS Selectors Quickstart The Role of Selectors in JavaScript Selectors in JavaScript Review

https://teamtreehouse.com/library/css-selectors-quickstart/the-role-of-selectors-in-javascript/selectors-in-javascript-r

I keep getting a green check mark which shows correct, but I get the bummer comment that says I am wrong. I have tried different things and it still does the same thing which is not helping me figure out what is correct, nor will it allow me to pass the quiz.

Please help!!

Steven Parker
Steven Parker
231,236 Points

Wow, I've never seen a green check mark with "Bummer" together!
Which of the 6 questions gives you that response, and what answer are you giving to make it appear?

3 Answers

Steven Parker
Steven Parker
231,236 Points

I tried all those answers and wasn't able to replicate the green check mark. I only got the red "X" along with "Bummer", which is what I would expect.

But for getting the correct answer, let's look at the question: "Use an attribute selector to assign an element with a data attribute of data-close ...". So the name of the attribute we want is "data-close", and an attribute selector is made up of an attribute name enclosed in brackets [].

I'll bet you can get it now, but write again if you still have trouble.

Happy coding!

This is the question,

Consider the following HTML code:

<button type="button" class="close" data-close="modal">

Use an attribute selector to assign an element with a data attribute of data-close to the variable closeBtn:

var closeBtn = document.querySelector('');

THE ANSWERS I PUT WERE, var closeBtn = document.querySelector('data-closebtn '); var closeBtn = document.querySelector('data-button'); var closeBtn = document.querySelector('data-modal');

got it!!!! thank you so much... @StevenParker

Noelle Lewis
Noelle Lewis
7,895 Points

Im not understanding

Steven Parker
Steven Parker
231,236 Points

Are you having a similar issue? Try starting your own fresh forum post, and show both the question and your answer.