如何在javascript上的单个按钮上合并多个函数?

如何在javascript上的单个按钮上合并多个函数?,javascript,php,jquery,html,Javascript,Php,Jquery,Html,我想使用嵌套在站点浏览步骤中的“确认密码表单”(它位于bootstrap-modal)。事实上,我刚刚做到了。但问题是我不能在一个按钮上合并两个不同的功能,即“确认密码”和“下一步” 合并这些功能的目的是: 当用户确认密码时,通常会关闭模式框,并且由于下面的代码而工作正常 <script> $(function(){ $("#basicModal").modal(); $(".update-password").click(function(){ v

我想使用嵌套在站点浏览步骤中的“确认密码表单”(它位于bootstrap-modal)。事实上,我刚刚做到了。但问题是我不能在一个按钮上合并两个不同的功能,即“确认密码”和“下一步”

合并这些功能的目的是: 当用户确认密码时,通常会关闭模式框,并且由于下面的代码而工作正常

<script>
$(function(){
    $("#basicModal").modal();

     $(".update-password").click(function(){

      var new_password = $("#new-password").val();
      var confirm_password = $("#confirm-password").val();

      if(new_password==""){
          $("#new-password").focus();
          return;
      }

      if(confirm_password==""){
          $("#confirm-password").focus();
          return;
      }
  });

  setTimeout(function(){
      $("#basicModal").modal('hide');
  },25000);

  $("#upd-btn").click(function(){
      $("#basicModal").modal();
  });
})

$(函数(){
$(“#基本模式”).modal();
$(“.update password”)。单击(函数(){
var new#u password=$(“#new password”).val();
var confirm_password=$(“#confirm password”).val();
如果(新密码==“”){
$(“#新密码”).focus();
返回;
}
如果(确认密码==“”){
$(“#确认密码”).focus();
返回;
}
});
setTimeout(函数(){
$(“#基本模式”).modal('hide');
},25000);
$(“#upd btn”)。单击(函数(){
$(“#基本模式”).modal();
});
})

但它不应该再关闭并继续下一步。。所以我尝试合并它们,但我没有足够的代码经验来独自解决这个问题。。所以我需要你们在这个问题上支持我伙计们。。你在读书的时候,我会继续努力的。。谢谢大家

下面是“按钮”和“下一步”链接的相关代码

<div class="" id="step-id-1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
   <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            <h4 class="modal-title" id="myModalLabel">Create your password pls.</h4>
            </div>
             <form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post">
            <div class="modal-body">
                <p>You should fill the field with password </p>


                <p><input type="password" class="form-control input-lg" id="new-password" required placeholder="Yeni Şife.." name="new-password" /></p>
                <p><input type="password" class="form-control input-lg" id="confirm-password" required placeholder="Repeat you password pls.." name="confirm-password" /></p>
                <?php if($flag){ ?>
                <div style="padding:5px 10px; color:#fff; background:#F00">Passwords are unmatched, refill the form please</div>
                <?php } ?>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

               **<button type="submit" class="btn btn-primary update-password">Confirm your password</button>**

        </div></form>  

              **<a href="#" data-powertour-action="next" style="float:right">Next step</a>**
    </div>
  </div>
</div>

&时代;
请创建您的密码。

让一个函数调用另一个函数,或者创建同时调用这两个函数的第三个函数,然后用按钮调用第三个函数

嗨,约瑟夫,谢谢你的快速回复:)不幸的是,我对js一无所知。。只是编辑值粘贴不同的变体以使其正常工作:/ok,您要执行的两个不同的函数是什么?它们在你粘贴的代码中吗?按钮“更新密码”中有一个类,我相信它的功能是确认psw并关闭模式。。但当我将数据powertour action=“next”添加到按钮时。。这一次下一个功能工作,但“更新密码”