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

195
Views
how to prevent a form-submitting refreshing page when submit is called without button?
<form id="form1" name="form1" method="post">
...
</form>
function f(){
    document.form1.method="post";
    document.form1.submit();
}

I've tried these methods, but all failed:

1.

change method f:

    document.form1.method="post";
    document.form1.submit(function(e) {
        e.preventDefault();
    });

failed.

2.

change form element:

<form id="form1" name="form1" method="post" onclick="return false" onsubmit="return false">
...
</from>

failed.

Is there any way to prevent submitting refreshing the page where the form is?

Thanks a lot.

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!