Learn Form Validation by Building a Calorie Counter - Step 45

Tell us what’s happening:

Task is to pass input[type=text] to querySelectorAll and then get the length of querySelectorAll.What is wrong?

Your code so far

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

/* file: styles.css */

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

function addEntry() {
  const targetInputContainer = document.querySelector(`#${entryDropdown.value} .input-container`);
  const entryNumber = targetInputContainer.querySelectorAll('input=type["text"]').length;
}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 45

Hi @zm17jaga

The selector is not quite right.

You should pass the string input[type="text"] to the querySelectorAll() method.

Everything after input needs to go in the square brackets.

Happy coding

1 Like