【发布时间】:2018-01-22 14:48:24
【问题描述】:
我的 input type = "checkbox" 被选中时的行为不同,它仅适用于第一个 input type="checkbox" 的一个元素,但对于其他输入它不正确。
input[type="checkbox"] {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
width: 16px;
height: 16px;
background-color: #fff;
border: 1px solid #cccccc;
cursor: pointer;
transition: 0.3s;
}
input[type="checkbox"]:checked {
background-color: #d9a83f;
}
<div class="first_body">
<input type="checkbox" id="checkbox__id" class="checkbox regular_checkbox" value="value" />
<label for="checkbox__id">Европейская</label>
</div>
<div class="last_body">
<div class="last_body_child">
<input type="checkbox" id="checkbox__id" class="checkbox regular_checkbox" value="value" />
<label for="checkbox__id">Италия</label>
</div>
<div class="last_body_child">
<input type="checkbox" class="checkbox regular_checkbox" />
<label for="checkbox__id">Франция</label>
</div>
</div>
当您单击其他时,即使您单击其他输入,也只会检查输入类型="checkbox" 的第一个元素。每个单独的输入都应单独突出显示。
我该如何解决这个问题?
【问题讨论】: