Learn Form Validation by Building a Calorie Counter

I finished the Learn Form Validation by Building a Calorie Counter lesson activity on FreeCodeCamp. I’m trying to read it so I can absorb it better.

In the provided HTML, there’s a submit button with the id calculate-calories:
<button type="submit" id="calculate-calories">Calculate Remaining Calories</button>)

But it doesn’t seem to be explicitly used in the JavaScript code. Instead, the form with the id calorie-counter was used for the event listener for the ‘submit’ event .

<form id="calorie-counter">
const calorieCounter = document.getElementById('calorie-counter'); calorieCounter.addEventListener("submit", calculateCalories);

I’m curious about the purpose of having the button’s id in the first place. Is there a specific reason for it? It wasn’t use in CSS either?

Looks like you’re right, that id isn’t being used anywhere. I’m guessing it’s just an oversight. Originally it was going to be used for something, and then after who know how many revisions to the project, it ended up not being used but no one removed it.

I have created an issue open for contribution to remove the unused id