Is there an “after submit” jQuery option?
问题 I have a form that uploads a file and targets an iframe on the page. When the user clicks submit, I want the file contents to "clear" out. I tried this $('#imageaddform').submit(function(){ $('#imagefile').val(''); }); But it clears the form before the submit, so nothing is ever uploaded. Is how do I clear after submit? 回答1: If you have no other handlers bound, you could do something like this: $('#imageaddform').submit(function(e) { e.preventDefault(); // don't submit multiple times this