jQuery auto upload file

前端 未结 2 1459
-上瘾入骨i
-上瘾入骨i 2020-12-31 05:33

I want the file input will automatic upload my image without enter any submit button.

2条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-31 05:57

    You can submit the form on the file input's onchange event, like this:

    $("input[name=upload]").change(function() {
        $(this).closest("form").submit();
    });
    

提交回复
热议问题