本文介绍了单选按钮无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的网页中,我放置了一些单选按钮。但是这些按钮无法正常工作。
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 属性,它们应该有一个共同的名称值,就像你分组项目一样..例如
< 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" >fiddle
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" />Demo
更多推荐
单选按钮无法正常工作
发布评论