0

Can ya all please point out whats wrong with this code?

I want to select a button and when i submitt it it displays the selected button . https://code.sololearn.com/WN55oIc9L9m7/?ref=app

9th May 2022, 11:29 AM
Rio
5 Antworten
+ 2
Hi Rio : It looks like you got some help from the community. I applied many of the corrections to see if I could get it to work with their suggestions. But in the end I discovered an easier way with less code. Let me know if this helps. https://code.sololearn.com/WGhog17fIpVR/?ref=app
9th May 2022, 9:25 PM
Chris Coder
Chris Coder - avatar
+ 3
Seems like the function's name "click" is in conflict with something else. Just change the name. Another problem is click(){...} instead of function(){...} in the argument list. Also getElementByClassName doesn't exist. These are just some of the errors, you'll have to spend some time debug your code.
9th May 2022, 11:41 AM
OrHy3
OrHy3 - avatar
+ 2
Some issue: * line 13: let i = 0 * line 14: addEventListener * you don't close the function definition of click * you try to add click() inside of the function definition of click() * you try to attach the same function twice to the buttons: once in html, once via js
9th May 2022, 11:54 AM
Lisa
Lisa - avatar
+ 1
If you want to have so.e rating questionnaire consider using radio buttons for simplicity
9th May 2022, 11:56 AM
Lisa
Lisa - avatar
0
Hey Chris Been having a problem implementing the suggesions Thankyou for your help,it worked😊
10th May 2022, 6:29 AM
Rio