单选按钮就像复选框一样 [英] Radio-button act like checkbox
本文介绍了单选按钮就像复选框一样的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码:
HTML:
<label><input type="radio" name="radio"> Checkbox 1</label>
<label><input type="radio" name="radio"> Checkbox 2</label>
JavaScript:
JavaScript:
$(document).ready(function(){
$(":radio").behaveLikeCheckbox();
});
JSFiddle 。
我从此处。我的问题是我无法使其正常工作。
I got the code from here. My problem is that I can't make it work.
有人可以帮忙吗?
推荐答案
您唯一需要做的就是为收音机添加一个不同的名称。当您给它们起相同的名字时,只有一个被选中。
The only thing you have to do is put a different "name" to your Radios. When you put the same name to them, only one gets "selected".
这篇关于单选按钮就像复选框一样的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文