假设用户已经将一些图片上传到“输入”标签中。如何用jQuery清空(也就是重置)下面的“输入”标签?
<form id="ImgForm" enctype="multipart/form-data">
<input name="pictures[]" type="file" multiple />
</form>发布于 2013-09-19 04:23:48
$('#ImgForm input[type="file"]').val('');或
$('#ImgForm').reset(); // will reset form.或
// trigger reset button click event manually
$('#ImgForm input[type="reset"]).trigger('click');发布于 2013-09-19 04:23:54
您可以使用reset重置表单。
$('#ImgForm').each(function(){
this.reset();
});如果您想要删除/清空它的值
$('#ImgForm input[type="file"]').val('');https://stackoverflow.com/questions/18886131
复制相似问题