Learn Form Validation by Building a Calorie Counter - Step 48

Tell us what’s happening:

My code says I should add an input element on a new line.Any help on this

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"></input>`;
}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 48

do you need a closing tag for the input element?

Removed it and still won’t submit.

you also need to remove the semicolon from inside the string

1 Like

Here is an example of how we should use the backtick for multiple strings:

> `string text line 1
>  string text line 2`
1 Like

thank you so much~ this helped!