Learn Form Validation by Building a Calorie Counter - Step 44

Tell us what’s happening:

I’ve tried several things but I definitely don’t get how to solve it in my HTMLString

Step 44

Inside your template literal, create a label element and give it the text Entry # Name. Using your template literal syntax, replace # with the value of entryNumber.

Your code so far

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>

 `;
}

You didn’t added label opening and closing tags. You need to add required Syntex between the label opening and closing tags. Reset your challenge and try again.
@stephane.gioanni

You have an extra space in the opening label tag.


I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').


If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.

The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

Here are the code I tried then, with label opening and closing tags but it still not working
What do you mean by the required syntex?

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

Thanks for the tips

I solved it

it was like this

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

Which is weird because it looks the same than your answer, but it wasnt working previously…

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