Jquery function BEFORE form submission

后端 未结 7 2173
一整个雨季
一整个雨季 2020-12-13 08:25

I am trying to fire a function using Jquery when the form submit button is clicked, but the function needs to fire BEFORE the form is actually submitted.

I am trying

7条回答
  •  执笔经年
    2020-12-13 08:43

    Just because I made this mistake every time when using the submit function.

    This is the full code you need:

    Add the id "yourid" to the HTML form tag.

    the jQuery code:

    $('#yourid').submit(function() {
      // do something
    });
    

提交回复
热议问题