Why can't radio buttons be “readonly”?

前端 未结 13 1221
误落风尘
误落风尘 2020-11-27 10:45

I would like to show a radio button, have its value submitted, but depending on the circumstances, have it not editable. Disabled doesn\'t work, because it doesn\'t submit t

13条回答
  •  渐次进展
    2020-11-27 11:03

    Radio buttons would only need to be read-only if there are other options. If you don't have any other options, a checked radio button cannot be unchecked. If you have other options, you can prevent the user from changing the value merely by disabling the other options:

    
    
    

    Fiddle: http://jsfiddle.net/qqVGu/

提交回复
热议问题