submit a form with jQuery after delay

后端 未结 2 1656
一生所求
一生所求 2020-12-18 09:37

I have a very simple form in HTML and I\'d like to submit this form after 2000ms (of delay) from when the document is ready, without push the submit button. How can I do thi

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-18 09:52

    You need to wait with delay() function and then submit() the form itself:

    $(function() {
        $('#my_form').delay(2000).submit();
    });
    

提交回复
热议问题