I am having a bit of trouble trying to figure out how to get a certain part of my code to work.
(我在尝试弄清楚如何使我的代码的某些部分工作时遇到了一些麻烦。)
<input type="checkbox" id="check_all_1" name="check_all_1" title="Select All" onclick="selectAll(document.wizard_form, this);">
<label for="check_all_1" onclick="toggleCheckbox('check_all_1'); return false;">Select All</label>
This is my HTML which works as it should (clicking the text will click the box).
(这是我的HTML工作原理(单击文本将单击该框)。)
The javascript for it is pretty simple:(它的javascript非常简单:)
function toggleCheckbox(id) {
document.getElementById(id).checked = !document.getElementById(id).checked;
}
However I want the onclick to happen for the input when the label is what makes the checkbox to be clicked.
(但是,当标签是单击复选框的时候,我希望输入发生onclick。)
At this current time the onClick js does not go.(在这个当前时间onClick js不会去。)
What is one suggestion on how to do this?(关于如何做到这一点的一个建议是什么?)
I tried to add the onclick of the input to the onclick of the label but that doesn't work.(我试图将输入的onclick添加到标签的onclick,但这不起作用。)
Any suggestions/solutions would be wonderful.
(任何建议/解决方案都会很精彩。)
ask by Craig translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…