如何使单选按钮和复选框的禁用/只读功能 [英] How to make disabled/readonly functionality for radio buttons and checkboxes

查看:116
本文介绍了如何使单选按钮和复选框的禁用/只读功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我们不能使 只读 单选按钮和复选框.我试图禁用单选按钮和复选框,但在IE中不可见.

I know we can't make readonly radio button and checkbox. I tried to disable radio button and checkbox but in IE it is not visible.

是否有其他替代方法可以使用jQuery,CSS,JavaScript像 disabled / readonly ?

Is any alternative way to do the same like disabled / readonly using jQuery, CSS, JavaScript?

推荐答案

您可以使用以下代码来避免点击您不希望用户更改的元素

You can use the following code to avoid clicks on elements you don't want user to change

$(':radio,:checkbox').click(function(){
    return false;
});

您可以使用适当的选择器来限制点击次数.

You can use proper selector to limit the clicks.

这篇关于如何使单选按钮和复选框的禁用/只读功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆