Learn Form Validation by Building a Calorie Counter - Step 48

Tell us what’s happening:

It says to put the input element on a new line, but I type placing a /n in different places, but nothing passed, I looked at this cold and everything seems correct.

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 (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 48

Sorry, I just reread what I wrote and now I’m laughing at myself.

so you are okay? (no help required?)

I still need help, I have no clue how you had a line to this.

this line of code has a template literal which is stored in a variable called HTMLString

They want you to add another element after the label element (but make sure to include it in the literal, which means the final backtick should come after the new line of code)

example of a template literal:

const tlit = `<p>this is a p element</p>
<a href="www.google.com">and a link</a>
<h3>all inside a template literal</h3>`;
2 Likes

Hi, I’ve been looking at your code. The literal template must cover the entire text. Actually . Currently, it only covers the first label but not the input

2 Likes

Okay, thank you, that helped!

2 Likes

Once I saw your example, it made since.

1 Like

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