$('#myModal').on('hidden.bs.modal', function () {
$('#fm').data('bootstrapValidator').destroy();
$('#fm').data('bootstrapValidator', null);
clearForm($('#fm'));
formValidator(); //重新加载验证
});
//清空文本框内容
function clearForm(form) {
// input清空
$(':input', form).each(function () {
var type = this.type;
var tag = this.tagName.toLowerCase(); // normalize case
if (type == 'text' || type == 'password' || tag == 'textarea')
this.value = "";
// 多选checkboxes清空
// select 下拉框清空
else if (tag == 'select')
this.selectedIndex = -1;
});
};
我是又手动清空了一次
bootstrap中modal框数据不清空,怎么解决
最新推荐文章于 2021-06-21 10:59:59 发布