Tell us what’s happening:
Not going to lie, I’ve looked up other responses and I am completely lost as to what the step is asking of me. Any assistance would be great.
Thanks!
STEP INSTRUCTIONS:
Pass the string input[type="text"]
to the querySelectorAll()
method. Remember that you will need to use single quotes for your string, so that you can use double quotes within.
This will return a NodeList
of all the text inputs in the form. You can then access the length
property of the NodeList
to get the number of entries. Do this on the same line.
Your code so far
function addEntry() {
const targetInputContainer = document.querySelector(`#${entryDropdown.value} .input-container`);
const entryNumber = targetInputContainer.querySelectorAll('input[type="text"]'); querySelectorAll('input[type="text"]').length;
}
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Challenge Information:
Learn Form Validation by Building a Calorie Counter - Step 42