1

Need help with fixing radiobuttion selection. In the image, you can see all buttons selected but only one button should be selected and others should be deselected automatically. with Standard HTML Input type radio, it works fine. But I want to try with Lightning Input radio button

Component Page enter image description here

HTML CODE enter image description here

1 Answer 1

0

You need to specify a name and value, just as you would in normal HTML.

<lightning-input name={item.id} type="radio" value={item.options.a}></lightning-input>

This will allow you to get the radio behavior, as well as tell which item is selected.

Note that the name must be the same for all type="radio" that should behave as a single radio selection, which is why I used item.id as the unique name. You can derive another name if you desire, just make sure they are unique on the page.

Demo.

1
  • OMG @sfdcfox It worked!!!! Thanks so much. you are a pure genius. God bless you. Mar 22 at 14:42

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.