简体   繁体   English

单击按钮jQuery时显示对话框

[英]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, 将您的js代码更改为此,

$(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), *假设您在对话框上有一个ID为finalSubmit的按钮(要在单击时提交表单),

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');
    })
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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