Getting Data from Multiple Buttons on Click
Hello,
I'm trying to add an event listener to all buttons within a div, using code such as:
I then need to be able to get the value of each button depending on click. I call the calculate function (not added here) which will eventually do a calculation based on an input & the value attribute of a button. However, I'm not sure how to get the value attribute of the button clicked. I know I can log all values but running
I'm trying to add an event listener to all buttons within a div, using code such as:
I then need to be able to get the value of each button depending on click. I call the calculate function (not added here) which will eventually do a calculation based on an input & the value attribute of a button. However, I'm not sure how to get the value attribute of the button clicked. I know I can log all values but running
btn.value, but I need to be able to do so on click.