我有一个表格
<form onSubmit="return disableForm(this);" action="upload.php" method="post" name="f" id="wizecho" enctype="multipart/form-data">
<input type="file" name="file" />
<button onClick="return disableForm(this),ajaxUpload(this.form,'wizecho_upload.php', '<br>Uploading image please wait.....<br>'); return false;">
Upload Image
</button>
</form>
上传图片
这里我需要点击按钮上传图片,我必须使用onClick
事件。我想删除上传按钮,一旦在输入中选择了文件,我就想触发事件。我该怎么做??
最佳答案
在文件输入上使用更改事件。
$("#file").change(function(){
//submit the form here
});
关于javascript - 如何在文件选择上触发事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5942821/