Learn Form Validation by Building a Calorie Counter - Step 48

Tell us what’s happening:

I’m unable to submit and go ahead.
everything looks good to me

Your code so far

/* 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>\n
  <input type="text" placeholder="Name" id="${entryDropdown.value}-${entryNumber}-name" />`;
}

// User Editable Region

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 48

Welcome to the forum @kaykay11

You cannot use escape characters with template literals.
Instead, press enter on the keyboard for a new line.

Happy coding

1 Like

but they said to provide id as well.

Hi @Awais0101 - Everything except the \n is correct with the code. Yes, there should be an id attribute as well. So long as it is on the proper line in the template string, the code will pass.

Hope this helps

I stuck here as well before finally figuring it out:

Mod edit: code removed

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.