【发布时间】:2019-08-26 22:38:24
【问题描述】:
我正在尝试增加标签中复选框的可点击区域。
但是,其中还有 2 个锚标记,当我尝试单击平板电脑上的复选框时,我会被重定向到超链接,因为复选框的可单击区域很小,但锚标记的区域更大。
我需要让它们在平板电脑上都可以点击,但也可以点击复选框。
这是当前的布局:
由于我也不能将 :before 作为 jQuery 上的一个 DOM 元素,所以我也不能修改它。 有什么建议吗?
[type="checkbox"]:not(:checked)+label:before,
[type="checkbox"]:checked+label:before {
content: '';
position: absolute;
left: 0;
top: 1px;
width: 16px;
height: 16px;
border: 1px solid #000;
background: transparent;
}
<label class="form-label checkout-label">
<span class="form-label-forced-span">
I agree with the <a href="$url('Page-Show', 'cid', 'policy-link')$"
target="_blank" aria-label="confidentiality and protection
policy">confidentiality and protection policy</a> and <a href="$url('Page-
Show', 'cid', 'terms-and-uses')$" target="_blank" aria-label="the terms of use">the
terms of use</a>.
</span>
</label>
【问题讨论】:
-
请也分享您的html
-
@TVBZ 分享了上面的相关html代码。谢谢。
标签: jquery css checkbox mouseevent