<form id="form">
<input type="checkbox"><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
</form>
<script>
window.onload = function () {
var form = document.getElementById('form');
form.onclick = function (e) {
e = e || event;
var target = e.target || e.srcElement;
if (target.type == 'checkbox') {
var next = target.nextSibling;
if (next && next.tagName == 'INPUT') {
if (next.style.display == 'inline') {
next.style.display = 'none';
} else {
next.style.display = 'inline';
}
} else {
var inp = document.createElement('input');
inp.style.display = 'inline';
this.insertBefore(inp, next);
}
}
}
}
</script>