📜  使用 JavaScript 代码示例防止重复提交

📅  最后修改于: 2022-03-11 15:01:52.793000             🧑  作者: Mango

代码示例1
var form = document.getElementById('formID');
var submitButton = document.getElementById('submitID');

form.addEventListener('submit', function() {

   // Disable the submit button
   submitButton.setAttribute('disabled', 'disabled');

   // Change the "Submit" text
   submitButton.value = 'Please wait...';
            
}, false);