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

177
Visualizações
Reset button on form not working for javascript?

I am trying to reset every input that has been entered on this form when the "reset" button gets clicked. Below is my code that I tried using, the reset button wont reset anything. Thank you.

    <form id="todoForm">
        <input type="text" id="todoInput" placeholder="Input new note..">
        <input type="text" id="description" placeholder="Input description..">
        <button type="button" id="button" onclick="todoList()">Submit</button>
        <button type="button" id="reset" onclick="resetForm()">Reset</button>
    </form>
    <ol id="todoList">
    </ol>
 
      function todoList() {
    var item = document.getElementById("todoInput").value
    var text = document.createTextNode(item)
    var addItem = document.createElement("li")
    addItem.appendChild(text)
    document.getElementById("todoList").appendChild(addItem)

     var item = document.getElementById("description").value
     var text = document.createTextNode(item)
     var addItem = document.createElement("p")
     addItem.appendChild(text)
     document.getElementById("todoList").appendChild(addItem)
    }

   function resetForm() {
   document.getElementById(todoList).reset();
   }
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Don't add a reset button.

Assuming this is a todo app users can just delete the todo after creating it. Adding a reset button probably won't provide much value to users, instead it will most likely frustrate ones that click it by mistake.

about 4 years ago · Juan Pablo Isaza Relatório
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