[英]Make the selected RadioButton in a RadioButtonList unclickable but not disabled
I have an ASP.Net page with several RadioButtonList controls on it. 我有一个ASP.Net页面,上面有几个RadioButtonList控件。
I want to display this page in a read-only format, but I would like the selected radiobutton in each RadioButtonList to appear "normal" ie not look disabled but not allow RadioButton to be clickable as I don't want the value to be modifyable. 我想以只读格式显示此页面,但我希望每个RadioButtonList中选定的单选按钮显示为“正常”,即不显示禁用但不允许RadioButton可点击,因为我不希望该值可修改。
I'm sure this has been answered somewhere but my googling is failing me at the moment... 我确信这已经在某个地方得到了解答,但我的谷歌搜索目前还没有让我失望......
How about overlaying a div on top of radio buttons container div with maximum z-index and alpha set to max so that it will appear transparent. 如何在最大z-index和alpha设置为max的单选按钮容器div上叠加div,使其显示为透明。 This makes radio buttons unclickable
这使得单选按钮不可点击
Try this http://jsfiddle.net/chintupawan/ztT5j/ 试试这个http://jsfiddle.net/chintupawan/ztT5j/
To stop the button from also not beeing clickable you can use a div to overlay over them. 要停止按钮也不能点击,您可以使用div覆盖它们。
http://jsfiddle.net/heXQf/ http://jsfiddle.net/heXQf/
<form>
<div class="row">
<div class="block"></div>
<input type="radio" name="sex" value="male" id="rdo"/> Male<br />
<input type="radio" name="sex" value="female" id="rdo"/> Female
</div>
</form>
form{width:300px;position:relative;}
.block{width:100px;display:block;height:100px;position:absolute;top:0;}
$('#rdo').click(function(e) {
e.preventDefault();
});
Try this jQuery: 试试这个jQuery:
$('.class-of-radio-button').click(function(e) {
e.preventDefault();
});
Fiddle: http://jsfiddle.net/c_kick/Gkp2Z/ 小提琴: http : //jsfiddle.net/c_kick/Gkp2Z/
try this 尝试这个
$("input[type!='radio'], select, textarea ").attr('disabled',true);
$("input[type='radio']").click(function(e){
e.preventDefault();
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.