Home > Article > Web Front-end > Detailed explanation of how JavaScript disables the submit button after form submission
This article mainly introduces the method of javascript to make the submit button unavailable after the form is submitted. It involves the techniques of dynamically modifying the form style with javascript. It is very simple and practical. Friends in need can refer to the following
Examples of this article Use javascript to implement a method to make the submit button unavailable after the form is submitted. Share it with everyone for your reference. The details are as follows:
After using javascript to control the form submission, the submit button is unavailable, which can prevent 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>
The above is the detailed content of Detailed explanation of how JavaScript disables the submit button after form submission. For more information, please follow other related articles on the PHP Chinese website!