Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

103
Views
Display the details entered into the form in console - disable submit until valid

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
  }
})

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!