How can I prevent a double submit with jQuery or Javascript?

前端 未结 10 1302
终归单人心
终归单人心 2020-12-08 22:44

I keep getting duplicate entries in my database because of impatient users clicking the submit button multiple times.

I googled and googled and found a few scripts,

10条回答
  •  猫巷女王i
    2020-12-08 23:12

    Here is bit of jQuery that I use to avoid the double click problem. It will only allow one click of the submit button.

    $(document).ready(function() {
      $("#submit").on('click', function() {
      });
    });
    

提交回复
热议问题