Javascript 模式关闭时,引导模式中表单的输入字段不会重置

Javascript 模式关闭时,引导模式中表单的输入字段不会重置,javascript,twitter-bootstrap,bootstrap-modal,Javascript,Twitter Bootstrap,Bootstrap Modal,我在引导模式中有一个表单。第一次它是空的,但当我第二次打开它时,它仍然包含先前填充的字段。我试过了 <script> $(function() { $('.modal').on('hidden.bs.modal', function(){ $(this).removeData('bs.modal'); }); }); $(函数(){ $('.modal').on('hidden.bs.modal',function()){ $(this.remov

我在引导模式中有一个表单。第一次它是空的,但当我第二次打开它时,它仍然包含先前填充的字段。我试过了

<script>
$(function() {
    $('.modal').on('hidden.bs.modal', function(){
        $(this).removeData('bs.modal');
    });
});

$(函数(){
$('.modal').on('hidden.bs.modal',function()){
$(this.removeData('bs.modal');
});
});

但它不起作用

你可以做一件事。此时关闭模式时,请清除输入、文本区域字段。因此,下次打开模式时,所有字段都将为空

$('.modal').on('hidden.bs.modal', function (e) {
  $(this)
    .find("input,textarea,select")
       .val('')
       .end()
    .find("input[type=checkbox], input[type=radio]")
       .prop("checked", "")
       .end();
})

尝试使用('show.bs.modal',function(){代替('show.bs.modal').on('show.bs.modal')