How can I submit a form using JavaScript?

后端 未结 10 1626
北海茫月
北海茫月 2020-11-22 16:43

I have a form with id theForm which has the following div with a submit button inside:

10条回答
  •  悲哀的现实
    2020-11-22 17:03

    It works perfectly in my case.

    document.getElementById("form1").submit();
    

    Also, you can use it in a function as below:

    function formSubmit()
    {
        document.getElementById("form1").submit();
    }
    

提交回复
热议问题