[英]How to Refresh the Bootstrap modal fields after modal close
我有一个带有动态输入字段的Bootstrap模态,我需要在关闭模态后清空所有字段值。(即)我需要在模式关闭后刷新模态。 我试过clear();
和
$('body').on('hidden.bs.modal', '.modal', function () {
$(this).removeData('bs.modal');
});
但是没有为我工作。请为此建议一个有效的解决方案。 提前致谢..
只需遍历模态中的每个输入并清除其值:
$('body').on('hidden.bs.modal', '.modal', function () {
$(this).removeData('bs.modal');
$(this).find("input").each(function(input) {
input.val("");
})(
});
希望这有帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.