JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › General Discussions › uncheck a radioButton after the values are submitted? › Reply To: uncheck a radioButton after the values are submitted?
September 28, 2021 at 8:49 am
#102305
Member
Hi Tony,
When you have radio buttons grouped always one of the radio buttons must be checked as this is the proper behavior of RadioButton component.
However if you need to set the checked button to be the same before the form is submitted I have prepared a quick code snippet that showcases how to set the checked property of the first radio button component:
//In your click/submit handler funciton:
const radiobuttons = document.querySelectorAll('smart-radio-button ');
radiobuttons[0].checked= true;
Let me know what you think!
Please, do not hesitate to contact us if you have any additional questions.
Best regards,
Yavor Dashev
Smart UI Team
https://www.htmlelements.com/