我具有以下清除输入表单的功能:
function clearForm(form) {
$(':input', form).each(function() {
var type = this.type;
var tag = this.tagName.toLowerCase();
if (type == 'text' || type == 'password' || tag == 'textarea')
this.value = "";
else if (type == 'checkbox' || type == 'radio')
this.checked = false;
else if (tag == 'select')
this.selectedIndex = -1;
});
};
有什么办法可以阻止它清除“隐藏”的输入?
提前致谢。
最佳答案
当然可以
$(':input', form)
采用
$(':input:visible', form)