Learn Form Validation by Building a Calorie Counter - Step 49

Okay, you’re saying that I have syntax errors there. In order for me to find and correct them, please indicate exactly what errors I have and what should I fix?

Please read what I wrote. I pointed out one already.

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>

Yes, I’ve just done it: input is on a seperate line, but it doesn’t solve the problem.

See above, you still have syntax problems, including the one I explicitly called out.

I’ve removed the extra brackets:

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>```

Why did you remove the one you picked to remove?

According to your recommendations, this bracket was superfluous, wasn’t it?

That doesn’t answer my question.

You wrote: “For example, I don’t understand why a new } was added.” So I concluded that the parenthesis was superfluous. How else can I improve my code? What other syntax errors do you think there are?

You had two } in that snippet of code. Why did you remove the one you picked to remove?

You write: “There were two of them in this code snippet}. Why did you delete the one you chose to delete?” This part of the brackets was unpaired, so I deleted it. Do I need to remove the second, paired brackets as well?

How did you determine which of the } was the one that was unpaired?

Doing this immediately after quoting someone is not helpful.

{- is one, unpaired, {}- are two, paired brackets.

Ok, I won’t do it any more.

I’m not sure if you are trolling here.

There is one { and two } in this code

How did you pick which of the two } was the one that didn’t correspond to the {

I’m not trolling anyone, I’m just trying to find my mistakes in the code based on your comments. Please don’t think that I’m trolling you.

How did you pick which of the two } was the one that didn’t correspond to the {

In this case I think I should remove both brackets before and after the statement:

<input type="text"placeholder="Name" id="${entryDropdown.value}-${entryNumber}-name" ></input>

But unfortunately it doesn’t work.

Why would you want the new line of code to be outside of your function?

Why would removing both } and making the { unpaired help?

I think so because the bottom console says: Sorry, your code does not pass. Hang in there.

You should add an input element on a new line.