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

205
Visualizações
Is there a way to open a new panel everytime a button is clicked?

I have a panel that has 3 textareas for a user to add certain information. It then goes through the process of being saved to the database. On every click of a button, I want the same empty panel to appear which will allow the user to enter multiple entries

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

I put together this little code for you, hope it helps you

//Simple HTML with 3 textarea
<div>
    <form action="">
        <textarea name="" id="" cols="30" rows="10"></textarea>
        <textarea name="" id="" cols="30" rows="10"></textarea>
        <textarea name="" id="" cols="30" rows="10"></textarea>
        <span id="btn">Click me!</span>
    </form>
</div>

So anytime the button #btn is clicked, first the form is submitted and then the textarea is cleared.

// The Javascript
const
    btn = document.querySelector('#btn'),
    form = document.querySelector('form'),
    textarea = document.querySelectorAll('textarea')

function clearFields() {
    for (let i = 0; i < textarea.length; i++) {
        textarea[i].value = '';
    }
}

btn.addEventListener('click', function() {
    // functionality to asynchronously submit and save user entry to DB
    submitFormToServer()

    // Clear all the textarea
    clearFields()
})
about 4 years ago · Juan Pablo Isaza Relatório

0

After button click event you could call a Redirect to the same page which will clear out the textboxes or explicitly clear them out (Textbox1.Text = "" etc.)

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