When the submit button is clicked, the browser's console should neatly display the details entered into the form but The submit button should not be functional and should look disabled as long as the required fields are not filled in.
const inputEl = document.querySelector(".input");
const nameEl = document.querySelector(".name");
const numberEl = document.querySelector(".number");
const emailEl = document.querySelector(".email");
const commentEl = document.querySelector(".comment")
const hourEl = document.querySelector(".hour")
myForm = [nameEl, numberEl, emailEl, commentEl, hourEl]
inputEl.addEventListener("click", () => {
for (let i = 0; i < myForm.length; i++) {
console.log(myForm[i].value); // this is work!
}
});
let formValue = {}
inputEl.disabled = true
myForm.forEach(change => {
if (formValue === myForm.value) {
inputEl.disabled = false;
} else {
inputEl.disabled = true; // when i put this code to disable the butten its work but its cancel the first one
}
})