单选按钮无法正常工作 [英] Radio button is not working properly
本文介绍了单选按钮无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的网页中,我放置了一些单选按钮。但是这些按钮无法正常工作。
code:
<标签for =abcstyle =margin-top:-20px; margin-left:40px> xyz< / label>
< input type =radioid =abcname =abc>
< label for =bcdstyle =margin-top:-20px; margin-left:40px> abc< / label>
< input type =radioid =bcdname =bcd>
< label for =efgstyle =margin-top:-20px; margin-left:40px> ccc< / label>
< input type =radioid =efgname =efg>
我只想检查一个按钮。
解决方案
因为您对 name $ c $有不同的值c>属性,它们应该有一个共同的
名称
值,就像你分组项目一样..例如
< input type =radioname =group1/>
< input type =radioname =group1/>
< input type =radioname =group1/>
<! - 您可以从每个组中选择一个 - >
< input type =radioname =group2/>
< input type =radioname =group2/>
< input type =radioname =group2/>
In my web page I have placed some radio buttons. But these buttons are not working properly. I can check multiple buttons.
code:
<label for="abc" style="margin-top:-20px;margin-left:40px">xyz</label>
<input type="radio" id="abc" name="abc" >
<label for="bcd" style="margin-top:-20px;margin-left:40px">abc</label>
<input type="radio" id="bcd" name="bcd" >
<label for="efg" style="margin-top:-20px;margin-left:40px">ccc</label>
<input type="radio" id="efg" name="efg" >
I want to check only one button. Please any one help me.
解决方案
Because you've different value for name
attribute, they should have a common name
value, just like you group items.. for example
<input type="radio" name="group1" />
<input type="radio" name="group1" />
<input type="radio" name="group1" />
<!-- You can select any one from each group -->
<input type="radio" name="group2" />
<input type="radio" name="group2" />
<input type="radio" name="group2" />
这篇关于单选按钮无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文