Home  >  Article  >  Web Front-end  >  Three ways to make the button gray and unavailable after clicking the submit button_javascript skills

Three ways to make the button gray and unavailable after clicking the submit button_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:22:255939browse

The first method: directly add

to the button

When you click submit, the submit button turns gray and becomes unavailable, which can effectively prevent repeated submissions. This code implements such a function. As can be seen from the code, we only need to add this sentence to the submit button: onclick="javascript:{this.disabled=true;document.form1.submit();}", which means that when the button is clicked, the button The unavailable attribute is set to true, so that the button becomes gray

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