Html格式文本框以模态存储值?

时间:2017-03-14 12:59:55

标签: html angularjs modal-dialog bootstrap-modal

我在我的html表单中使用了modal,并且我使用angular $ scope varible来绑定使用ng-model的文本框,所以如果我先打开模态并输入一些值并关闭模态并重新打开它,那么值是之前输入的内容仍然保持原样。我想在模态打开的任何时候将其设为空白。我试过把autocomplete =" off"在输入标签中,但对我没有用。

1 个答案:

答案 0 :(得分:1)

要重置输入值,请使用以下关于模态关闭,即

$('#my-modal').on('hidden.bs.modal', function () {
    $(".modal-body input").val("");//this will reset all the input values
});

我希望这会有所帮助:)