单选按钮无法正常工作

编程入门 行业动态 更新时间:2024-10-27 01:31:15
本文介绍了单选按钮无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在我的网页中,我放置了一些单选按钮。但是这些按钮无法正常工作。

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

更多推荐

单选按钮无法正常工作

本文发布于:2023-11-27 05:29:36,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:无法正常   单选   按钮   工作

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!