Learn Form Validation by Building a Calorie Counter - Step 46

Tell us what’s happening

whats wrong in this code

Your code so far

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

WARNING

The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 46

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

Welcome to the forum @tristanng14

The tests are very strict about spacing.

  1. remove the space before the tag name
  2. remove the spaces in the placeholder attribute value.

Happy coding

i only added the spaces so it would let me send the code there arent any spaces in my code i went onto youtube and also looked exactly how others did it and its still wrong

Hi @tristanng14

Post you full code so the forum can assist further.

Use the following method to post code to the forum:

  1. On a separate line type three back ticks.
  2. On a separate line paste your code.
  3. On the last line type three back ticks. Here is a single back tick `

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” placeholder=“Name” for=. “${entryDropdown.value} -${entryNumber}-name” />`;

obviously no spaces in the for and type attributes

Hi @tristanng14

Please reset the step to restore the original code.

Swap the for attribute in your code to an id attribute.

  1. remove the dot and space after the equals sign
  1. remove the space before the hyphen and dollar sign, then paste the modified code into the editor.

Happy coding

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.