Home >Web Front-end >JS Tutorial >jQuery implements a method to change the submit button to 'Processing' when clicked and prohibit clicking_jquery

jQuery implements a method to change the submit button to 'Processing' when clicked and prohibit clicking_jquery

WBOY
WBOYOriginal
2016-05-16 16:07:531339browse

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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn