Value of submit button clicked

后端 未结 6 2130
眼角桃花
眼角桃花 2021-02-07 08:58

This should be really straight forward.

I\'m checking if a form is being submitted using jquery. The form has multiple submit buttons with various values:



        
6条回答
  •  梦谈多话
    2021-02-07 09:47

    I ended up using the click event on each submit button, as others have suggested. That works fine, and you can return false from them if you want to cancel the submit. Just don't try to also bind the submit event of the form. You could also have each of these handlers call a common submit-handler function, passing their own value as an argument.

提交回复
热议问题