Get the App
SLTechnology News&Howtos  ›  Development  › 

How javascript hides option options

Shulou Source: shulou.com Published: 2022-06-02 02:45:27 09月16日 Update

This article mainly explains "javascript how to hide option options", the article explains the content 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 hide option options" bar!

Methods to hide option options: 1, use the "document.getElementById (id)" statement to get the specified option object according to the id value; 2, use the "option object .style.display =" none "statement to hide the specified option option.

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

Javascript's method of hiding the option option

The idea of realization is:

Use getElementById () to get the specified option option

Sets the display= "none" style to the specified option option and hides it.

Implementation code:

Please select: 1 2 3 option option function my (id) {return document.getElementById (id) with hidden value 2 } my ("btn"). Onclick = function () {my ("opt") .style.display = "none";}

Thank you for reading, the above is the content of "javascript how to hide option options", after the study of this article, I believe you have a deeper understanding of how javascript hides option options, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Learning content objects ideas methods statements code that is situations tutorials articles more styles environment computers knowledge knowledge points articles systems follow Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS NVidia vpn Shulou Tech Info MariaDB