简体   繁体   中英

Show Dialog when clicking button Jquery

在此处输入图片说明 在此处输入图片说明 I have two buttons in the form. I want to disable both of these buttons when I press one of these two buttons. And want to show the dialogue modal when I press login button. However, It can't work well in this part. Here is my code!

$(function(){
  $(".js-disable-form-individual").on("submit", function() {
    $('.js-disable]-btn').click(function() {                                                                                                         
      $('#loading-modal').modal('show');
    })
  $(this).find("input[type=submit]").prop('disabled', true);
  })  
});

Thank you for answering.

Change your js code to this,

$(function(){
  $(".text-center input[type=submit]").on("click", function(event) {  
    event.preventDefault();                                                                                                      
    $(".text-center input[type=submit]").prop('disabled', 'disabled');
  });
  $('.js-disable-btn').on("click",function(){                                                                                                         
    $('#loading-modal').modal('show');
  });  
  $('#finalSubmit').on("click",function(){                                                                                                         
    $(".js-disable-form-individual").submit();
  });
});

*Say if you have a button which id is finalSubmit on the dialog (which you want to submit form on click),

I'm not sure, try to separate them?

$(function(){
  $(".js-disable-form-individual").on("submit", function() {
     e.preventDefault();     
     $(this).find("input[type=submit]").prop('disabled', true);
  }) 

  $('.js-disable-btn').on('click',function() {                                                                                                         
      $('#loading-modal').modal('show');
    })
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM