Jquery function BEFORE form submission

后端 未结 7 2176
一整个雨季
一整个雨季 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:50

    You can use the onsubmit function.

    If you return false the form won't get submitted. Read up about it here.

    $('#myform').submit(function() {
      // your code here
    });
    

提交回复
热议问题