Prevent users from submitting a form by hitting Enter

后端 未结 30 3435
感动是毒
感动是毒 2020-11-21 05:13

I have a survey on a website, and there seems to be some issues with the users hitting enter (I don\'t know why) and accidentally submitting the survey (form) without clicki

30条回答
  •  [愿得一人]
    2020-11-21 05:40

    1. Do not use type="submit" for inputs or buttons.
    2. Use type="button" and use js [Jquery/angular/etc] to submit form to server.

提交回复
热议问题