Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

109
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda