Home  >  Article  >  Web Front-end  >  How to set the button to disappear after clicking it in html5

How to set the button to disappear after clicking it in html5

WBOY
WBOYOriginal
2022-01-23 14:10:175695browse

Method: 1. Bind the click event to the button element and specify the event processing function; 2. In the event processing function, use the style attribute and display attribute to set the button to disappear after clicking the button. The syntax is "button Element object.style.display="none"".

How to set the button to disappear after clicking it in html5

The operating environment of this tutorial: Windows 10 system, HTML5 version, Dell G3 computer.

html5How to set the button to disappear after clicking the button

The Style object represents a separate style statement. A Style object can be accessed from the document or element to which the style is applied.

Syntax for using the Style object attribute:

document.getElementById("id").style.property="值"

The display attribute specifies the type of box that the element should generate.

When the value of the attribute is set to none, this element will not be displayed.

The example is as follows:








Output result:

How to set the button to disappear after clicking it in html5

Recommended tutorial: "html video tutorial"

The above is the detailed content of How to set the button to disappear after clicking it in html5. For more information, please follow other related articles on the PHP Chinese website!

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