Home > Article > Web Front-end > Disabled button cannot pass value_html/css_WEB-ITnose
The radio button made with disabled cannot pass the value. What else can achieve the same invalidation effect and can also pass the value?
Set it to readOnly="readOnly"
Oppa, I want to make it happen The radio button is invalid. It can still be selected if it is set to readOnly.
Use an c726a8da2e1b0a50980b1ad4157a77d3 to save the value.
The displayed control is only displayed but has changed its state. It needs to be synchronized. input
I mean a readonly-like effect
example
<script>function disRadio(){rss = document.getElementsByName("r")for(i=0;i<rss.length;i++){if(!rss[i].checked)rss[i].disabled=true;}}function enableRadio(){rs = document.getElementsByName("r")for(i=0;i<rs.length;i++){rss[i].disabled=false;}}</script><form method="get"><input name=r type=radio value=1> <input name=r type=radio value=2> <input type=button value="禁用" onclick="disRadio()"><input type=button value="启用" onclick="enableRadio()"> <input type=submit value="提交"></form>