The example in this article describes how to use JavaScript to make the submit button unavailable after the form is submitted. Share it with everyone for your reference. The details are as follows:
Here, JavaScript is used to control the submit button to be unavailable after form submission, which prevents users from submitting multiple times.
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>表单提交后按钮禁用</title> <script type="text/javascript"> function sub() { document.forms[0].elements[0].disabled = true; document.forms[0].submit(); } </script> </head> <body> <form action="login.action" method="post"> <input type="button" name="btn" value="提交表单" onclick="return sub();" /> </form> </body> </html>
I hope this article will be helpful to everyone’s JavaScript programming design.