模态框的表单怎么重置

发布网友

我来回答

2个回答

热心网友

在模态的隐藏事件中可以调用表单重置
` //模态隐藏调用
$("#jgdwModal").on("hide.bs.modal", function () {
type = undefined;

$("#inputLatitude").val('');//纬度
$("#inputLongitude").val('');//经度

document.getElementById("baseinfoform").reset();
$("#deptselect").select2('val', '');
$("#inputArea").select2('val', '');
$("#inputsshy").select2('val', '');
$("#baseinfoform").data('bootstrapValidator').resetForm();
if (nodeid != undefined) {
GetJCDwList(nodeid, $("#searchtext").val());
}
});`

热心网友

在里的表单里面添加一个type="reset"的Button就可以了啊!点击后就会清空! 或者可以用循环遍历表单中的控件!软后让文本框的内容清空就ok啊!

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com