我想重置具有id的表单user_post.此表单还包含隐藏字段.我使用此代码重置输入表单字段
$('#user_post').each(function(){
this.reset();
});
Run Code Online (Sandbox Code Playgroud)
我的表格如下
<form enctype="multipart/form-data" id="user_post" action="/****/index.php/site/username" method="post">
<div class="tab-content">
<div id="tab-1" >
<textarea rows="3" placeholder="Share what have been up to...." name="Userpost[usertxtpost]" id="Userpost_usertxtpost"></textarea>
</div>
<div id="tab-2" >
<textarea rows="1" placeholder="Title...." name="Userpost[title]" id="Userpost_title"></textarea>
<input id="Userpost_image" type="hidden" value="" name="Userpost[image]" />
<input tabindex="21" name="Userpost[image]" id="Userpost_image" type="file" />
<input name="Userpost[imagename]" id="Userpost_imagename" type="hidden" />
<textarea rows="3" placeholder="about this image...." name="Userpost[coment]" id="Userpost_coment"></textarea>
</div>
<div id="tab-3" class="tab-pane row-fluid fade">
<input name="Userpost[video_title]" id="Userpost_video_title" type="hidden" />
<textarea rows="1" placeholder="Copy and paste video url...." name="Userpost[video]" id="Userpost_video"></textarea> …Run Code Online (Sandbox Code Playgroud)