Learn Form Validation by Building a Calorie Counter - Step 50

Tell us what’s happening:

It keeps saying, “Your new input element should have a type attribute set to number.” But it is? It’s the first element I’ve added? I’ve been staring at this code so long that it doesn’t look right no matter what :C

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" />
  <label for="${entryDropdown.value}-${entryNumber}-calories">Entry ${entryNumber} Calories</label>
  <input type="number" min="0" placeholder="Calories" id="${entryDropdown.value}-${entryNumber}-calories"`;
}

// User Editable Region

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

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 50

1 Like

I am looking for the input closing bracket > but I can’t find it?

2 Likes

Now, at Step 50 the chalenge is about creating a 2nd label on a new line at the end of HTMLString. As Javascript-algorithms-and-data-structures-v8 is in Beta version I think there is a change in the steps, this happened to me also in step 47 where I found help regarding the next step and what I am looking for is already in the code as a previous step. this how step 50 look like now: https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-form-validation-by-building-a-calorie-counter/step-50.

Hi there !

The curriculum challenges are recently updated.

1 Like

hey @Bakar

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 Help button located on the challenge. This button only appears if you have tried to submit an answer at least three times.

The 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.

1 Like