Learn Form Validation by Building a Calorie Counter - Step 46

Tell us what’s happening:

Hey,

i don’t understand why I get the error: You should have a label element inside your template literal.

Can someone 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>Entry ${entryNumber} Name</label>`;  
}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Safari/605.1.15

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 46

I tried running your solution and I got the same error. I moved the backticks to their own lines and this made the test pass. Maybe it will work for you, too.

  const HTMLString = `
    <label>Entry ${entryNumber} Name</label>
  `;