Skip to content
Advertisement

How to reset form radio buttons to unchecked in reactjs?

I have made 4 radio buttons for 1 question. I have made 2 buttons submit and clear input. When I submit the form after clicking on clear input it does not clear the checked buttons to unchecked how can I do that using reset function ?

contactform.js:

JavaScript

See screenshots:

enter image description here

enter image description here

Advertisement

Answer

Give a checked attribute for you radio button. Change

JavaScript

to

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement