Learn Form Validation by Building a Calorie Counter - Step 50

Tell us what’s happening:

Correct the error here,

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" id="${entryDropdown.value}-${entryNumber}-name" placeholder="Name" /><br>
  <label for="${entryDropdown.value}-${entryNumber}-calories">Entry${entryNumber} Calories</label>`;
}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0.1 Safari/605.1.15

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 50

Please Tell us what’s happening in your own words.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more you say, the more we can help!

I’m unable to pass this question due to punctuation errors.

Ok. Where did you get stuck trying to fix those issues?

Here’s my updated code,Preformatted text

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" id="${entryDropdown.value}-${entryNumber}-name" placeholder="Name" />;
Entry${entryNumber} Calories
}

{Your new label element should have the text Entry ${entryNumber} Calories}

Yes. I can see your code. I cannot just type the answer for you; that’s against the rules.

Can you provide a solution(correct this…)on this code?

I’ve done it lol! I saw what I needed to do.

1 Like

guys my code so far
Entry ${entryNumber} Calories
}
it is telling me that “You should not modify your existing elements” please help me

Hi there and welcome. Create your topic to the challenge step using Help button. It’s appear below the challenge editor, when you try to submit wrong code more than three times.