Making Enter key on an HTML form submit instead of activating button

前端 未结 7 1586
北恋
北恋 2021-02-03 16:33

I have an HTML form with a single submit input, but also various button elements. When the user presses the \'enter\' key, I\'d expect it to actually s

7条回答
  •  温柔的废话
    2021-02-03 17:12

    Given there is only one (or with this solution potentially not even one) submit button, here is jQuery based solution that will work for multiple forms on the same page...

    
    

提交回复
热议问题