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

181
Views
can't diasble autorefresh o the page

i have a form where user should make new inputs

now user can make new input BUT once only


index.html

<form id="MyForm">
            <input type="text" class="Line" id="Line0">
</form>

index.js

MyForm.addEventListener('submit', {
    handleEvent(event) {//make new line
        event.preventDefault();
        let myForm = document.getElementById("MyForm");
        myForm.insertAdjacentHTML("beforeend", "<input type='text' class='Line'id='line1'>")
    }
})

i have tried :

function new_line(index, event) {
    //change all indexes before this object
    let FormArray = Array.from(MyForm)
    MyForm.insertAdjacentHTML("beforeend", "<input type='text' class='Line' id='Line" + FormArray.length + " onsubmit='return new_line(" + FormArray.length + ")'>")
    event.preventDefault();
}

and

function new_line(index) {
    //change all indexes before this object
    let FormArray = Array.from(MyForm)
    MyForm.insertAdjacentHTML("beforeend", "<input type='text' class='Line' id='Line" + FormArray.length + " onsubmit='return new_line(" + FormArray.length + ")'>")
    return false;
}

but both of this functions update the page before i understand do they work or not

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!