Recovering interrupter with occasional relapses, lover of spreadsheets, blogger, programmer, adept debugger, conjurer of analogies, and probably other things.
On line 21 of script.js it looks like it's doing something unintended.
What's happening is you are looping through the array of buttons but on line 21 are always asking does the 0th element of buttonArray exist? (Which it always does). To visualize this, you could add a debug/breakpoint in your code.
I don't do much front-end coding, but here's how I'd approach this is:
When I click on one of the numbers, I need to update an element with that value.
When I click submit, I want to get the value of the element I updated.
Perhaps whenever you click a rating button set a data attribute on the submit button. Then when you click submit, read that data attribute. See the Mozilla Developer docs on Data
On line 21 of script.js it looks like it's doing something unintended.
What's happening is you are looping through the array of buttons but on line 21 are always asking does the 0th element of
buttonArray
exist? (Which it always does). To visualize this, you could add a debug/breakpoint in your code.I don't do much front-end coding, but here's how I'd approach this is:
Perhaps whenever you click a rating button set a
data
attribute on the submit button. Then when you click submit, read thatdata
attribute. See the Mozilla Developer docs on DataThank you so much. I will look into this and hope that it works 🤞🏾