Learn Form Validation by Building a Calorie Counter - Step 55

Tell us what’s happening:

Based on what I have seen in the other forum posts, this should be correct. What am I doing wrong?

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 + 1;
  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"
    id="${entryDropdown.value}-${entryNumber}-calories"
    placeholder="Calories"
  />`;
  targetInputContainer.innerAdjacentHTML();
}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 55

Can you talk about what you tried to verify that your code produces the correct result?

1 Like

I can’t verify it as it has not given me a result? I don’t think I understand your question.

You have written code. Did you try running the code (i.e. by clicking the button you’re trying to fix?)

1 Like

Ah I see my issue now! I was typing innnerAdjacentHTML when I was supposed to put insertAdjacentHTML.

1 Like

Yup. Trying to make the code run often can give us more information to work with.

I was running it often, I just misread the instructions just about every time :frowning:

The instructions are important to read carefully. The instructions don’t give a

TypeError: targetInputContainer.innerAdjacentHTML is not a function

error though. Trying to use the functionality gives you that.