@sj0n
Posted
Instead of attaching click event on all the buttons, you could just bind submit event on the form element. When submitted, the form element will contain the data binded on the name from the input element. You could then use FormData function to parse data from the form element.
You can check out my solution if you need an idea on how to solve this challenge.
[1] https://developer.mozilla.org/en-US/docs/Web/API/FormData/FormData
Marked as helpful
@hejkeikei
Posted
@sj0n Thank you so much! This is what I'm looking for! I notice that you style the icon with js instead of css. May I ask why?
@sj0n
Posted
@hejkeikei Sorry for the late reply. I'm assuming you're referring to the element with the class "class_icon"? You could technically do that, but you'll need to write a separate class and modify the element's class with JavaScript.