调用的时候这样:
- <form action="findGoodScore.action" method="post">
- <input type="button" value="清空" onclick="clearForm(this.form)"/>
- </form>
清空FORM表单:
- /*
- * 清空objE为form表单
- * objE可以为id or class
- */
- function clearForm(objE){//objE为form表单
- $(objE).find(':input').each(
- function(){
- switch(this.type){
- case 'passsword':
- case 'select-multiple':
- case 'select-one':
- case 'text':
- case 'textarea':
- $(this).val('');
- break;
- case 'checkbox':
- case 'radio':
- this.checked = false;
- }
- }
- );
- }