我正在尝试创建一个带有复选框的简单表单。我使用的代码是
<label>
<span>Questions:
<div class="childWindow">
<input class="checkedInput" id="defAsked" name="defAsked" type="checkbox" checked/>
</span>
</label>
<span>Send frequently asked questions</span>
</div>
<label>
<textarea rows="3" cols="50" placeholder="Please ask if you have any questions" name="questions" id="questions" ></textarea>
</label>
我想将复选框的有效选中区域限制为仅限于框,目前如果我单击 text:Send frequently asked questions
,复选框将被切换。我将提供指向此文本的链接,因此不希望它在单击链接时切换
最佳答案
label 标签用于将其他元素绑定(bind)到表单元素。从 label 标签中删除文本以使其不触发复选框检查。
<label>
<input type="checkbox" checked/>
<span>This will trigger checkboxage</span>
</label>
<span>This won't trigger checkboxage</span>
请看这个 fiddle :http://jsfiddle.net/casTu/
关于html - 复选框的表单设计问题,限制选中区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24222134/