Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

138
Vistas
Two Forms in jquery onclick of submit Loading symbol has to change

I am working jquery form. Where I have two forms in a page and when I submit the form one form should say please wait for the button clicked.

And other form display loading symbol instead of please wait. Please find my code in jsfiddle

Here is my reference code

$("form").submit(function() {
  if ($("email").validate().checkForm()) {
   $(this).find('input[type=submit]').prop('disabled', true);
   $(this).find('input[type=submit]').prop('value', 'Please wait...');
 } else if ($("sample_data").validate().checkForm()) {
   $(this).find('input[type=submit]').prop('disabled', true);
   $(this).find('input[type=submit]').prop();
   //How to add gif image here
 }
 });

Here is the HTML code

    <form name="email" action="#" method="post">
  <label for="email">Your Email</label>
  <input name="Email" id="email" type="email">
  <input type="button" value="submit">
</form><br /><br />
<h2>
  Testing Form
</h2>
<form name="sample_data">
  <label for="fname">First Name</label>
  <input name="fname" id="fname_id" type="text"><br />
  <label for="lname">Last Name</label>
  <input name="lname" id="lname_id" type="text">
    <input type="button" value="submit">
</form>
<div class="loadingio-spinner-spinner-cm0pdtzvpde">
  <div class="ldio-rfcqdr7w4x">
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
  </div>
</div>

Please let me know What I am doing wrong here.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

  • To call $("form").submit(), you will need to change your input button to submit. That is <input type="submit" value="submit">
  • To prevent the form from being submitted to the server you will need to pass in e, which is the event and call e.preventDefault();. This will allow the JQuery code to continue to run.
  • ("email").validate().checkForm() - I wasn't too sure what you intentions were. If you want to call the checkForm method on the email form then try $("form[name='email'").validate().checkForm(). Alternatively you could add an ID or Class to the form.

Here is a demo https://jsfiddle.net/xptycbu7/

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda