How JavaScript hides html tags
This article mainly introduces JavaScript how to hide html tags, the article is very detailed, has a certain reference value, interested friends must read it!
Methods: 1, use "document.getElementById (" id ")" statement to get the specified html tag element object according to id value; 2, use "tag element object .style.display =" none ";" statement to hide the acquired html tag element.
The operating environment of this tutorial: windows10 system, javascript1.8.5 version, Dell G3 computer.
In JavaScript, to hide the html tag, you can use the "document.getElementById (" id ")" statement to get the specified html tag element object based on the id value.
Then use the style attribute and the display attribute to hide the acquired element object.
When the attribute value of the display element is none, the element is hidden.
Examples are as follows:
Document
Unordered list:
Sprite cola herbal tea document.getElementById ("xuebi") .style.display = "none"
Output result:
The above is all the content of the article "how JavaScript hides html tags". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!