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

216
Views
¿Es posible prevenir el valor predeterminado en html?

Cuando necesito evitar la reacción predeterminada, puedo poner mi función de controlador en onSubmit y todo funciona bien. <form onSubmit={handler}> . Pero, ¿cómo hago lo mismo en html puro? También necesito acceso al objeto del evento.

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

intenta hacer esto:

 <form onSubmit="return false;">

about 4 years ago · Juan Pablo Isaza Report

0

Podrías intentar algo como esto.

 <form id="form"> Enter name: <input type="text" name="name"> <input type="submit" value="Submit"> </form> <script> function onSubmit(event) { console.log(event); event.preventDefault(); alert("The form was submitted"); } var form = document.getElementById("form"); form.onsubmit = onSubmit; </script>

Referencia: https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onsubmit

about 4 years ago · Juan Pablo Isaza Report

0

Puedes hacerlo con la biblioteca jquery así:

 $(document).on('submit', '#your_form_selector', function(e) { e.preventDefault(); console.log("default submit action was prevented"); }
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!