# Learn Form Validation by Building a Calorie Counter - Step 43

**URL:** <https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-43/770729>\
**Category:** Curriculum Help\
**Tags:** javascript\
**Created:** [December 18, 2025, 6:38pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-43/770729 "2025-12-18T18:38:10Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![souadhamou72](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/souadhamou72/32/379601_2.png) [@souadhamou72](https://forum.freecodecamp.org/u/souadhamou72)\
**Post date:** [December 18, 2025, 6:38pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-43/770729/1 "2025-12-18T18:38:10Z")

</div>

### Tell us what’s happening:

They say " you should remove the targetId and i did but the code doesn’t pass.

### Your code so far

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

```

```css
/* file: styles.css */

```

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

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

// 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/143.0.0.0 Safari/537.36`

### Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 43

> **[freeCodeCamp.org](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-form-validation-by-building-a-calorie-counter/step-43)**
>
> Learn to Code — For Free

---

<div class="post-metadata">

**Author:** ![JeremyLT](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jeremylt/32/291894_2.png) [@JeremyLT](https://forum.freecodecamp.org/u/JeremyLT)\
**Post date:** [December 18, 2025, 6:47pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-43/770729/2 "2025-12-18T18:47:50Z")

</div>

> [@souadhamou72](#):
>
> `targetId`

Hmm, what is this here?

---

<div class="post-metadata">

**Author:** ![souadhamou72](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/souadhamou72/32/379601_2.png) [@souadhamou72](https://forum.freecodecamp.org/u/souadhamou72)\
**Post date:** [December 18, 2025, 6:49pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-43/770729/3 "2025-12-18T18:49:29Z")

</div>

${targetId}

i was asked to remove it

---

<div class="post-metadata">

**Author:** ![JeremyLT](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jeremylt/32/291894_2.png) [@JeremyLT](https://forum.freecodecamp.org/u/JeremyLT)\
**Post date:** [December 18, 2025, 6:50pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-43/770729/4 "2025-12-18T18:50:03Z")

</div>

That’s not what you were asked to remove though.

> Thanks to template literals, you actually don’t need the `targetId` variable at all. Remove that variable

---

<div class="post-metadata">

**Author:** ![souadhamou72](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/souadhamou72/32/379601_2.png) [@souadhamou72](https://forum.freecodecamp.org/u/souadhamou72)\
**Post date:** [December 19, 2025, 5:10pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-43/770729/5 "2025-12-19T17:10:14Z")

</div>

const targetInputContainer = document.querySelector(`${} .input-container`);

???

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [December 19, 2025, 5:23pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-43/770729/6 "2025-12-19T17:23:58Z")

</div>

it does not look like you have the requested value in the template literal, you need to replace `targetId` there, not just delete it

---

<div class="post-metadata">

**Author:** ![JeremyLT](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jeremylt/32/291894_2.png) [@JeremyLT](https://forum.freecodecamp.org/u/JeremyLT)\
**Post date:** [December 19, 2025, 5:40pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-43/770729/7 "2025-12-19T17:40:31Z")

</div>

Please use words to talk about how you are stuck instead of just posting code and hoping we’ll fix it.

---

<div class="post-metadata">

**Author:** ![souadhamou72](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/souadhamou72/32/379601_2.png) [@souadhamou72](https://forum.freecodecamp.org/u/souadhamou72)\
**Post date:** [December 19, 2025, 5:47pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-43/770729/8 "2025-12-19T17:47:20Z")

</div>

apologize, i was asked to remove targetId and even tho i did so, the code doesn’t pass.

---

<div class="post-metadata">

**Author:** ![souadhamou72](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/souadhamou72/32/379601_2.png) [@souadhamou72](https://forum.freecodecamp.org/u/souadhamou72)\
**Post date:** [December 19, 2025, 5:48pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-43/770729/9 "2025-12-19T17:48:04Z")

</div>

I’m not yet familiar with js, thats why i find this a little bit confusing

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [December 19, 2025, 5:54pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-43/770729/10 "2025-12-19T17:54:13Z")

</div>

you are asked to remove the variable, and replace it in the template literal

it says

> and update your template literal to replace `targetId` with `entryDropdown.value` – remember to add `#` before that, in the string.

you did not do this part

---

<div class="post-metadata">

**Author:** ![souadhamou72](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/souadhamou72/32/379601_2.png) [@souadhamou72](https://forum.freecodecamp.org/u/souadhamou72)\
**Post date:** [December 19, 2025, 6:11pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-43/770729/11 "2025-12-19T18:11:57Z")

</div>

Noted, thank you so much!

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [May 5, 2026, 5:35pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-43/770729/12 "2026-05-05T17:35:24Z")

</div>

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