function clear(dom) {
$(dom).find("input[type=text]").each(function() {
$(this).val("");
});
$(dom).find("input[type=hidden]").each(function() {
$(this).val(this.defaultValue);
});
$(dom).find("input[type=file]").each(function() {
$(this).val("");
});
$(dom).find("input[type=password]").each(function() {
$(this).val("");
});
$(dom).find("input[type=checkbox]").each(function() {
this.checked = false;
});
$(dom).find("input[type=radio]").each(function() {
this.checked = false;
});
$(dom).find("option").each(function() {
this.selected = false;
});
$(dom).find("textarea").each(function() {
$(this).val("");
});
}
js 清空页面录入信息
最新推荐文章于 2023-09-26 01:04:31 发布
本文详细介绍了如何使用jQuery实现表单元素的清空功能,包括文本输入框、隐藏域、文件输入、密码框、复选框、单选按钮、下拉选项和文本区域等各类表单元素的值的清空方法。
1万+

被折叠的 条评论
为什么被折叠?



