Clear upload file input field with javascript (JQuery)

<script language=”javascript” src=”jquery.min.js” type=”text/javascript”>
</script>

<script language=”javascript”>
function example_reset_html(id) {
$(‘#’+id).html($(‘#’+id).html());
}
</script>

<form>
<div style=”float: left;” id=”example_file”><input type=”file” /></div>
<input type=”button” value=”Clear” onclick=”example_reset_html(‘example_file’);”  />
</form>

Link: http://www.electrictoolbox.com/clear-upload-file-input-field-jquery/

发表评论

电子邮件地址不会被公开。

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>