1

I am not UI/UX person and I need help with setting radio button as checked when used in a LWC inner template-for-loop which involves page navigation and conditional rendering. I am able to get the selected value in my JS controller, but when I navigate back to the previous page, the "checked" property is not retaining although I still have the selected value. It might be easy to understand if you can look at the sample here:- Sample

The reason I went with custom component for radio group is due to applying CSS to individual radio input.

Any help is appreciated. Thank you!

2

You have to bind the checked attribute of the radio group to your data (e. g. via adding a checked property to your options object) in order to keep track of the selected dom element.

Updated your example here

  • Awesome. Thanks so much!! – malu Aug 8 at 1:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.