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

210
Views
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 answers
Answer question

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 Report

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 Report
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!