Why does this 'onClick disable=true; this.form.submit();' work on one button but not another?

后端 未结 1 520
梦毁少年i
梦毁少年i 2021-01-26 08:50

This code \'works\' - the button is disabled and the form submits. Happy days.

    
相关标签:
1条回答
  • 2021-01-26 09:22

    The issue lies with the name="submit" attribute on the second button. This causes an issue with Chrome, as it overrides the submit() function for your form, resulting in the error that FirstOne has observed in his comment:

    Uncaught TypeError: this.form.submit is not a function
    

    If you choose a different name (as you did for your first button) then it should work ok.

    0 讨论(0)
提交回复
热议问题