Home >Web Front-end >JS Tutorial >jQuery implements a method to change the submit button to 'Processing' when clicked and prohibit clicking_jquery
The example in this article describes how jQuery implements the method of realizing that the submit button turns into the word "Processing" after being clicked and prohibits clicks. Share it with everyone for your reference. The specific implementation method is as follows:
Here we mainly use the val method to set the text of the button, and use the attr method to modify the disabled attribute to achieve this function.
The main code is as follows:
<html> <body> <form method="get" action="" target="box"> <input id="buttonid" type="submit" value="提交" /> </form> <script type="text/javascript" src="js/jquery-1.6.2.min.js"></script> <script> $("form").submit(function() { $("#buttonid").val("正在处理..."); $("#buttonid").attr("disabled", "disabled"); }); </script> </body> </html>
I hope this article will be helpful to everyone’s jQuery programming.