? ? ?$('#theform')[0].reset();
reset()這個函數的作用是將表單的值重置,變為默認值,
例:
<input type="text" value="姓名">
這個標簽的默認值就是”姓名“,如果使用上面的方法,就會重置為“姓名”
?
下面介紹的這個,是清空的
$(':input','#theform')
.not(':button,:submit,reset,:hidden')
.val('')
.removeAttr('checked')
.removeAttr('selected')