Learn Form Validation by Building a Calorie Counter - Step 46

Tell us what’s happening:

I don’t know what could be happening because it is not being accepted as good.

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

Your code so far

<!-- file: index.html -->

/* file: script.js */
// User Editable Region

`;

// User Editable Region
/* file: styles.css */

Your browser information:

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

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 46

Hi!
It’s a bit hard to say how you’ve written it since the “Your code so far” section is empty, but in this step, the const HTMLString = ``; is already declared above the editable region, and you’re writing inside the string literal.
The way you’ve created the label and the text inside it looks correct. Could you update the preview so we could see if there are any other issues?

Sorry, this is my first post and I didn’t know how it worked. I hope the code is clearer in this response. I’m pasting the entire function, although the relevant part is the HTMLString constant

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>`;
}
1 Like

No worries! It takes a moment to get used to how the forum works. Yes, this is much easier to read, thank you!
The <label>Entry ${entryNumber} Name</label> looks correct, and that should be all you need to write for this step. If you reset the lesson and copy just that in the editable field, it should work fine:)

However, it doesn’t work (I have reset it and written that code exactly as it is, several times already.). I get the following feedback: ‘You should have a label element inside your template literal.’ Although I think that’s exactly what I did.”

hi there!
try to clear your browser cache or change the browser for the challenge step.

2 Likes

Hello Everyone,
I am facing the same problem in this step. I have done everything as instructed but the test did not pass. The code is below.

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

I have changed my browser but It did not work for me. Any help will be appreciated.

hey @mdkeum please use the Help button to open your own topic for this step