hey guys I have a problem. I want to make a programm where i can press buttons to add something to an array which i can read, so like an numpad. the layout and all is great but when i want to add the function that when i press a button the number is add to the array nothing happens.
Here is my code without that function in the webeditor: https://editor.p5js.org/TjarkTV/sketches/h_dgXDTqj
Please help me.
Would this do what you want (add it right above k++)?
let index = k;
When I copy-paste it there this massage comes up in the console:
TypeError: buttons[k].button is undefined (sketch: line 18)
Sorry, my bad. I changes something in the class as well: a getter to the button.
The class now returns a reference to the HTML button by means of the getter. that is used to attached the mousePressed to the button.
heyy i just wanted to thank you because it worked and I forgot to Thank you.
You’re welcome (was away for a bit…)