Learn Form Validation by Building a Calorie Counter - Step 46

  Step information :

After your label element, and on a new line in your template string, create an input element. Give it a type attribute set to text , a placeholder attribute set to Name , and an id attribute that matches the for attribute of your label element.

my Answer :

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" id="${entryDropdown.value}-${entryNumber}-name" placeholder="Name">
  `;
}

Problem :

You should add an input element on a new line.

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 46

Are you sure that you need the \n ?

2 Likes

You probably don’t need the \n for this test to pass. The test might expect a literal new line in your code. A simple “Enter”?

4 Likes

yes that’s what it says when i check the code

1 Like

i just checked that and it worked ! Thank you so much

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.