表單提交后。需要清空數據的幾種方法
1、第一種情況
jQuery沒有reset()方法,調用Java的reset()方法
$('.reset').click(function () {
$('#myform')[0].reset();
});
2、第二種情況 (排除法)
$('.reset').click(function () {
$(':input', '#myform')
.not(':button, :submit, :reset, :hidden,:radio')
.val('')
.removeAttr('checked')
.removeAttr('selected');
});
3、第三種情況(循環找到值)
$('.reset').click(function () {
$('.search_form').find(':text,select').each(function () {
$(this).val('');
});
$('input:checkbox').removeAttr('checked');
});
