Get the App
SLTechnology News&Howtos  ›  Development  › 

How javascript makes li hide

Shulou Source: shulou.com Published: 2022-06-01 07:40:38 09月19日 Update

This article mainly explains "javascript how to hide li", the content of the explanation is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "javascript how to let li hide" it!

In JavaScript, you can use the style attribute and the display attribute to set so that the li element is hidden, the style attribute is used to style the element, the display attribute is used to set the element hide, and the syntax is "li element object .style. display =" none ".

The operating environment of this tutorial: windows10 system, javascript1.8.5 version, Dell G3 computer.

How does javascript make li hide?

HTML DOM display attribute

The display property sets how the element is displayed.

Syntax:

Object.style.display=value

This element is not displayed when the property value is set to none.

Examples are as follows:

Function removeElement () {document.getElementById ("li1") .style.display = "none";} example the li element will hide after the button is clicked as follows: the li element will not be hidden after the button is clicked

Tags: Elements attributes buttons learning content examples grammar objects that is ideas situations tutorials articles more styles environment computers knowledge knowledge points articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Shulou Technology Linux Microsoft macOS