Learn Form Validation by Building a Calorie Counter - Step 39

Tell us what’s happening:

I’m not sure what’s wrong.

Your code so far

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

Your browser information:

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

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 39

What was the last hint you received?

I also see something very relevant in the directions.

Replace your concatenated string in the querySelector with a template literal – be sure to keep the space between your targetId variable and .input-container.

The selector should be a descendant combinator. This means you need a space between the two selectors.

document.querySelector(theId theClass);

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

1 Like

I figured it out, thanks!

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