Learn Form Validation by Building a Calorie Counter - Step 44

Tell us what’s happening: I tried looking at the forum for this step and I have tried both
and \n both advise to start the variable with a new line

Your code so far

Start your HTMLString with a new line, then create a label element. Give that element the text Entry # Name , using your template literal syntax to replace # with the value of entryNumber .

function addEntry() {
const targetInputContainer = document.querySelector(#${entryDropdown.value} .input-container);
const entryNumber = targetInputContainer.querySelectorAll(‘input[type=“text”]’).length;
const HTMLString = \n<label>Entry ${entryNumber} Name</label>;
}
WARNING

The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 44

1 Like

This is a known bug. You can’t use the \n escape character to add the new line. You must literally hit the Enter key to add the new line.

4 Likes

Spent an hour going crazy until I tried this. Thank you.

3 Likes

Oh man . Really! And here I tested all the things that came to my mind. lol

I still can’t get the hang of it

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.

Thanks was able to get it finally

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