只选择一个复选框 [英] Select only one checkbox

查看:96
本文介绍了只选择一个复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有多个复选框,但我想用户选择只有一个复选框。我尝试if-else语句,但它不是可用。所以,我想知道,怎么会这样。

I have a multiple checkboxes, but I want user to select one checkbox only. I try if-else statement but it is not useable. So, I want to know, how to be like that.

感谢

推荐答案

你为什么不使用单选按钮来代替?这意味着它们是正好为。

Why don't you use Radio Buttons instead? They are meant exactly for that.

但是,如果你坚持使用复选框,当它被选中禁用其他复选框修改,使得在选择任何复选框的事件。

But if you insist on using check boxes, modify the event of on select of any check box such that when it is selected it disables the other check boxes.

这篇关于只选择一个复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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