Learn Form Validation by Building a Calorie Counter - Step 70

Tell us what’s happening:

Hello! The directions say:

"Your function needs to get the values from the entries the user has added.

Declare a breakfastNumberInputs variable, and give it the value of calling document.querySelectorAll() with the selector #breakfast input[type='number']. This will return any numberinputs that are in the #breakfast element."

I feel like I’m doing exactly what the directions are telling me but obviously I’m missing something here. Is there anyone who can point me in the right direction? Thank you!

Your code so far

<!-- file: index.html -->

/* file: script.js */
// User Editable Region

function calculateCalories(e) {
  e.preventDefault();
  isError = false;
  const breakfastNumberInputs = document.querySelectorAll(#breakfast input[type='number']);

}

// User Editable Region
/* file: styles.css */

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.6 Safari/605.1.15

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 70

Hi there and welcome to our community!

You need to enclose the query within quotation marks.

EXAMPLE:

const description = document.querySelectorAll(".description")

Note that as your query already contains single quotes, you’ll need to wrap the query in double quotes, to avoid syntax issues.

It worked! Thank you for getting back to me so quickly. Can you explain why it needs to be in double quotes? I keep making simple syntax mistakes like this.

Thanks!

Document instance methods take string values as parameters (or expressions/variables which resolve to string values).