Learn Form Validation by Building a Calorie Counter - Step 42

Tell us what’s happening:

  1. You should use a template literal in your querySelector method.
  2. Your template literal should have the value ${targetId} .input-container.

Your code so far

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

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

function addEntry() {
  const targetId = '#' + entryDropdown.value;
  const targetInputContainer = 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/133.0.0.0 Safari/537.36

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 42

Hi there. You have a single quote before the template literals block in the beginning. Instead, you need back tick on both end around the query selector’s value

I still dont get it

Hi @harsya

Your querySelector is missing something before it.
Have a look at how you target other elements and selectors.

Happy coding

1 Like

Did you know about template literals string? How the template literals expression works?

Thank you! I miss the document and used the wrong ticks