Learn Form Validation by Building a Calorie Counter - Step 86

Tell us what’s happening:

I’m stuck on step 87 of the Building a Calorie Calculator lesson.

" Add an event listener to your calorieCounter element. The event type should be submit , and the callback function should be calculateCalories ."

Your code so far

calorieCounter.addEventListener(type=“submit”) {


The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.

Your browser information:

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

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 86

I’m sorry, stuck on step 86* I couldn’t find a way to edit the post so adding this comment here.

Hiya, you don’t need the “type=” I think that’s an HTML attribute thing. Also calculateCalories should be an argument inside .addEventListener. You don’t need curly brackets at all.

You have this code above.

addEntryButton.addEventListener("click", addEntry);

addEntryButton is the element, "click" is the event type, and addEntry is the callback.

It is the same thing you need to write again, but this time the element is calorieCounter, the event type is "submit" and the callback is calculateCalories.

1 Like