HTML Form Button value is not posted in Safari and Chrome

后端 未结 10 1945
旧巷少年郎
旧巷少年郎 2021-01-08 00:15

I am using jQuery to submit a form when a button is clicked. I would then like to test the value of the button, however, this doesn\'t get submitted in Safari and Chrome. Wh

10条回答
  •  猫巷女王i
    2021-01-08 01:03

    Button disabled during submit/click event doesn't submit its value

    As per Alan Stewart, I had this problem introduced when I wrote a little utility to prevent double-clicking a form submit button which listened for "submit" and disabled the button.

    I changed my code so it determines if the form has already been submitted, and if so, disables the button and prevents the form submitting via event.preventDefault().

    It's not as nice as before which immediately disabled the button which gave instant visual feedback (since Bootstrap has a style for disabled buttons).

提交回复
热议问题