Learn Form Validation by Building a Calorie Counter - Step 42

Tell us what’s happening:

I need help trying to solve the problem in step 42. I’m having trouble with spacing and I could use some assistance please.

Your code so far

<!-- file: index.html -->

/* file: script.js */
// User Editable Region

function addEntry() {
  const targetId = '#' + entryDropdown.value;
  const targetInputContainer = document.querySelector(`${targetId}
  .input-container`);
}

// User Editable Region
/* file: styles.css */

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 42

Welcome to the forum :wave:

be sure to keep the space between your targetId variable and .input-container.

It’s hard to tell how many spaces are between these when you also have a line break. The line break will be part of the template literal and shouldn’t be there as it’s not in the instructions.

The syntax for the template literal you have, is correct. What’s giving you issues is the space before .input-container. I had to close the console and the preview to have more space to watch that only 1 space was added, the line break prevents you from seeing that correctly.
code removed by moderator

hi @orves261214

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge. How to Help Someone with Their Code Using the Socratic Method

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

1 Like