您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

当引导模式关闭并重新打开时,如何重置该模式?

当引导模式关闭并重新打开时,如何重置该模式?

隐藏模态后,只需手动重置任何内容即可:

$(".modal").on("hidden.bs.modal", function(){
    $(".modal-body1").html("");
});






$(document).ready(function() {

  $(".modal").on("hidden.bs.modal", function() {

    $(".modal-body1").html("Where did he go?!?!?!");

  });

});


<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" />

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>



<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">

  Launch modal

</button>



<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

  <div class="modal-dialog">

    <div class="modal-content">

      <div class="modal-header">

        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span>

        </button>

        <h4 class="modal-title" id="myModalLabel">Modal title</h4>

      </div>

      <div class="modal-body">

        <div class='modal-body1'>

          <h3>Close and open, I will be gone!</h3>

        </div>

      </div>

      <div class="modal-footer">

        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

      </div>

    </div>

  </div>

</div>
其他 2022/1/1 18:17:20 有626人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶