const button = document.getElementById('submit'); const page = document.getElementById('page'); const check = document.getElementsByClassName('check'); const excla = document.getElementsByClassName('excla'); const entry = document.getElementsByClassName('entry'); const help = document.getElementsByClassName('help'); function displayHelp(id) { console.log(id); id.style.display = 'block'; } function hideHelp(id) { id.style.display = 'none'; } function checkInputs() { for (let i=0; i < entry.length ; i++) { console.log(i); if (entry[i].type != 'button') { if (entry[i].value == '') { setError(i); } else { setSuccess(i); } } } } function setError(indice) { check[indice].style.display = 'none'; excla[indice].style.display = 'block'; document.getElementsByTagName('small')[indice].style.display = 'block'; } function setSuccess(indice) { check[indice].style.display = 'block'; excla[indice].style.display = 'none'; document.getElementsByTagName('small')[indice].style.display = 'none'; }