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

146
Views
Mi función no muestra la alerta (preventDefault)

Estoy trabajando en una aplicación de lista de tareas pendientes (React.js) e intento utilizar la función preventDefault. Agregué un atributo onSubmit a mi elemento de formulario y quiero que muestre una alerta cuando se haga clic en el botón Agregar. El problema es que no parece funcionar, aquí está mi código

 function Form (props) { function handleSubmit(e) { e.preventDefault(); alert('Added') } return ( <form onSubmit={handleSubmit}> <h2 className="label-wrapper"> <label htmlFor="new-todo-input" className="label-lg"> What needs to be done? </label> </h2> <input type="text" id="new-todo-input" className="input input-lg" name="text" autoComplete="off" ></input> <button type="submit" className="btn btn-primary btn__lg"> Add </button> </form> ) } export default Form;
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!