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

170
Views
¿Hay una opción de jQuery "después de enviar"?

Tengo un formulario que carga un archivo y apunta a un iframe en la página. Cuando el usuario hace clic en enviar, quiero que el contenido del archivo se "borre".

probé esto

 $('#imageaddform').submit(function(){ $('#imagefile').val(''); });

Pero borra el formulario antes del envío, por lo que nunca se carga nada.

¿Cómo borro después de enviar?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Si no tiene otros controladores vinculados, podría hacer algo como esto:

 $('#imageaddform').submit(function(e) { e.preventDefault(); // don't submit multiple times this.submit(); // use the native submit method of the form element $('#imagefile').val(''); // blank the input });
over 4 years ago · Santiago Trujillo Report

0

La solución de Lonesomeday funcionó para mí, pero para Google Chrome descubrí que aún enviaría datos de formulario vacíos a menos que agregara un tiempo de espera como este:

 $('#imageaddform').submit(function(e) { e.preventDefault(); // don't submit multiple times this.submit(); // use the native submit method of the form element setTimeout(function(){ // Delay for Chrome $('#imagefile').val(''); // blank the input }, 100); });
over 4 years ago · Santiago Trujillo Report

0

Podrías hacer algo como esto:

 $('#imageaddform').submit(function(){ setTimeout(function() { $('#imagefile').val(''); },100); });
over 4 years ago · Santiago Trujillo 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!