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. 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.
Does anyone know what is the problem or did it have the same?