Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 具有独立行为的两组不同单选按钮_Css_Html_Radio Button - Fatal编程技术网

Css 具有独立行为的两组不同单选按钮

Css 具有独立行为的两组不同单选按钮,css,html,radio-button,Css,Html,Radio Button,我有两个不同的部分,由两个具有不同值和ID的单选按钮组成。问题是我一次只能检查一个按钮,但我需要这两组单选按钮独立工作,即在每组单选按钮中可以检查一个按钮。 以下是HTML: <section class="radio_holder_1"> <div class="radio"> <input id="share_this" type="radio" name="option_type" value="share_this" checked&

我有两个不同的部分,由两个具有不同值和ID的单选按钮组成。问题是我一次只能检查一个按钮,但我需要这两组单选按钮独立工作,即在每组单选按钮中可以检查一个按钮。 以下是HTML:

<section class="radio_holder_1">
    <div class="radio">
        <input id="share_this" type="radio" name="option_type" value="share_this" checked>
        <label class="hmc_radiolabel" for="share_this">Share Picture</label>
        <input id="use_4_now" type="radio" name="option_type" value="use_4_now">
        <label class="hmc_radiolabel" for="use_4_now">Instant Use</label>
    </div>
</section>
    <hr>
<section class="radio_holder_2">
    <div class="radio_2">
       <input id="free" type="radio" name="option_type" value="free" checked>
       <label class="hmc_radiolabel" for="free">FREE</label>
       <input id="premium" type="radio" name="option_type" value="premium">
       <label class="hmc_radiolabel" for="premium">VIP</label>
    </div>
</section>

问题是你的名字。为第二个选择使用不同的名称,它应该可以工作

<section class="radio_holder_1">
<div class="radio">
<input id="share_this" type="radio" name="option_type" value="share_this" checked>
<label class="hmc_radiolabel" for="share_this">Share Picture</label>
<input id="use_4_now" type="radio" name="option_type" value="use_4_now">
<label class="hmc_radiolabel" for="use_4_now">Instant Use</label>
</div>
</section>
<hr>
<section class="radio_holder_2">
<div class="radio_2">
<input id="free" type="radio" name="option_type2" value="free" checked>
<label class="hmc_radiolabel" for="free">FREE</label>
<input id="premium" type="radio" name="option_type2" value="premium">
<label class="hmc_radiolabel" for="premium">VIP</label>
</div>
</section>

只需为另一组的单选按钮的名称属性指定一个不同的值即可。谢谢@Xufox!这是我这边一个愚蠢的疏忽……谢谢@Xufox。我忘了还原代码的其余部分!