How do I submit a “file” input without submit button using JavaScript?

前端 未结 5 1656
栀梦
栀梦 2020-12-29 02:27

There is a way to automatically submit a form without clicking to a \"submit\" button?

I have a form with one \"file\" input. I would submit the form after the user

5条回答
  •  忘掉有多难
    2020-12-29 03:00

    yes, you can use the form.submit() function. Add an onchange listener on the file input and link it to the form.submit() function, like so:

提交回复
热议问题