Learn Intermediate Algorithmic Thinking by Building a Dice Game - Step 2

Tell us what’s happening:

I don’t know how to grab elements inside a div with an ID, I’ve researched it and can’t find a way to do it.

this is the prompt =>

The next step is to select all of the elements responsible for displaying the scores.

Use the querySelectorAll() method to access all of the input elements inside the #score-options div element and assign that result to a constant called scoreInputs.

Then use the querySelectorAll() method to access all of the span elements inside the #score-options div element and assign that result to a constant called scoreSpans.

the error I get is =>

You should target all of the input elements inside the #score-options div element.

Your code so far

const scoreInputs = document.querySelectorAll('#score-options div > input');
const scoreSpans = document.querySelectorAll('#score-options div > span');

WARNING

The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

Learn Intermediate Algorithmic Thinking by Building a Dice Game - Step 2

i’m also stuck on this and can’t seem to find any sollution…

i figured it out, the div is irrelevant , you’re already calling on the div by using the #id. you just have to specify what element you are trying to grab ie the input or spam

that’s what i figured, but somehow it still doesn’t work…

Please show us your code

const scoreInputs = document.querySelectorAll('#score-options > input');
const scoreSpans = document.querySelectorAll('#score-options > span');

You don’t need the >

2 Likes

thank you very much!