Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
163
rated 0 times [  166] [ 3]  / answers: 1 / hits: 186642  / 13 Years ago, mon, may 9, 2011, 12:00:00

I've a form as



<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', '&lt;br&gt;Uploading image please wait.....&lt;br&gt;'); return false;>
Upload Image
</button>
</form>


It is to upload an image.



Here I need to click on the button to upload the image and I've to use onClick event. I want to remove the upload button and as soon as the file is selected at the input, I want to fire the event. How do I do that??


More From » jquery

 Answers
180

Use the change event on the file input.



$(#file).change(function(){
//submit the form here
});

[#92320] Sunday, May 8, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
xochitl

Total Points: 559
Total Questions: 95
Total Answers: 117

Location: Antigua and Barbuda
Member since Sat, Apr 24, 2021
3 Years ago
;