I’m looking to create a particular broken interface: enabled radio buttons that cannot be clicked but do some action onclick
. I can write the onclick
function but the radio button always selects and stays selected. I’m using ReactJS but I don’t think that will make a difference. What should I do?
3
Answers
You can add "disabled" attribute to HTML inputs to make them uninteractable:
You can make use of the
checked
prop on the radio button to ensure if the radio button ischecked
or not.onChange
prop will help you do stuff when you click the button. You can use that to determine if you want to change your checked button.or: