function showCheckbox(){ var node_list = document.getElementsByClassName('check'); for (var i = 0; i < node_list.length; i++) { if(node_list[i].style.display == 'none') { node_list[i].style.display = 'block'; } else { node_list[i].style.display = 'none'; } } }
input[type=checkbox]{ display:none; position:relative; }
<input type="button" value="Εμφ?νιση" onclick="showCheckbox()" /> <img src="form-images\trash.png" onclick="" style="width:21px;height:24px;margin-left:20px; "/> <input type="checkbox" class="check" /> <label>Ψ?ρεμα</label> <input type="text" /> </br> <input type="checkbox" class="check" /> <label>Γ?πεδο</label> <input type="text"/> </br>
When the page loads for first time and I press the button on the first click it does not triggers the onclick function.(当页面首次加载时,我在第一次单击时按了按钮,但不会触发onclick功能。)
If I press it the second time it triggers the event.(如果我第二次按下它会触发事件。)
Other <input type="button"/>
buttons triggers the event on the first click without problem.(其他<input type="button"/>
按钮在第一次单击时触发事件,没有问题。) Does anyone know what is the problem or did it have the same?(有人知道问题出在哪里吗?)
ask by nikolaos_mparoutis translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…