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.

2/13/2020 3:55:15 PM


3 Answers

New Answer


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


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.


Thank you Sir (Gordon) for your quick reply. That was so simple.