+ 1
Radiobuttons not working
I'm trying to display a message when a particular radiobutton is selected. Code below: https://code.sololearn.com/WveVisYko7PD It ain't working.Please check.
3 ответов
+ 2
You are now checking only at beginning.
You should use onchange event listener instead.
https://code.sololearn.com/W01ZUJa8VQA5/?ref=app
Or a easier way, add your function as click callback to a button.
https://code.sololearn.com/WU0cgiMBknhI/?ref=app
+ 1
I have chosen the easy way with onclick attribute and onchange attribute in HTML tags.
A better way is to use addEventListener so that we can add more event listeners and also remove unnecessary event listeners later.
That will be after your DOM lessons.
0
Thank you Sir (Gordon) for your quick reply.
That was so simple.