Learn Form Validation by Building a Calorie Counter - Step 49

Tell us what’s happening:

Hello. Please help me. My code doesn’t pass because the right and bottom developer consoles both have some comments and complaints about the code: Sorry, your code does not pass. Hang in there.

You should not modify your label element.

// running tests

  1. You should not modify your label element.
  2. You should add an input element on a new line.
    // tests completed

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

// 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/128.0.0.0 Safari/537.36 OPR/114.0.0.0

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 49

You didn’t do this?

hey mate
try writing your code on a new line and watch the spacing
Happy coding

Will it be right?

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

The tests will tell you if that’s right

No, the whole code doesn’t pass yet.

It doesn’t still solve the proble.

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

Hi there!
That two attribute messing with each other. What you say about that?

You should read the error message and try to fix what it’s saying

According to the task : Step 49

After your label element, and on a new line in your template string, create an input element. Give it a type attribute set to text, a placeholder attribute set to Name, and an id attribute that matches the for attribute of your label element.

Just posting the instructions is not a reply to what he said. Please read what people say and reply to them.

// running tests 1. You should not modify your

label

element. 2. You should add an

input

element on a new line. // tests completed Sorry, your code does not pass. You’re getting there.

You should not modify your label element.

You should read what people say and reply to them instead of just posting random stuff

We now the instructions, can you explain what you did to the challenge editor. In your own words?

Yes, I can. I did a new line with the next code:

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

What that line have?

1 Like

No, you did not put the new code on a new line.

Thank you for your feedback. I appreciate your point of view and I agree that I should focus more on interacting with my colleagues and clients in my work. I will work on improving my communication skills and paying more attention to the feedback of others so that my responses are more useful and relevant. Thank you for the guidance! Sincerely, Dennis-code153

This is all on one line. If you have updated the code please share it again.

Why? The developer console writes about new line: " // running tests 1. You should not modify your

label

element. 2. You should add an

input

element on a new line. // tests completed"