Learn Form Validation by Building a Calorie Counter - Step 49

Tell us what’s happening:

Done and searched but cant seem to find the answer …I need help

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;
  const HTMLString = `
  <label for="${entryDropdown.value}-${entryNumber}-name">Entry ${entryNumber} Name</label>
  <input type="text" placeholder="Name" id="${entryDropdown.value}-${entryNumber}-name"/>
  <label for="${entryDropdown.value}-${entryNumber}-calories">"Entry ${entryNumber} Calories"</label>
  
  `;
}

// 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/126.0.0.0 Safari/537.36 Edg/126.0.0.0

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 49

Hi @osidev

Here is a comparison of the original code and your code.

The code in blue is the original code, the code in red is your code.
The code in magenta is the overlap.

You appear to have modified the input element.

Please copy the new label element, then reset the step to restore the seed code.

Then place your code back into the editor.
Make sure you remove the quote marks between the label tags.

Happy coding

Hi there!
Remove the quote marks around label text Entry ${entryNumber} calories.

I have the same problem. Please look at my code:

{entryDropdown.value} .input-container`);
  const entryNumber = targetInputContainer.querySelectorAll('input[type="text"]').length;
  const HTMLString = `
  <label for="${entryDropdown.value}-${entryNumber}-name">Entry ${entryNumber} Name</label>`;
  <input type="text" id="${entryDropdown.value}-${entryNumber}-name" placeholder="Name" </input>
}

and say what is wrong in it?

please keep using the topic you have open, do not post in 4 months old topics