I have a simple file upload form. How do I make it submit automatically when a file has been selected? I don't want the user to have to click the Submit button.
You can simply call your form's submit method in the onchange event of your file input.
submit
onchange
document.getElementById("file").onchange = function() { document.getElementById("form").submit(); };
http://jsfiddle.net/cwvc4/73/
2.1m questions
2.1m answers
60 comments
57.0k users