Home > Web Front-end > HTML Tutorial > 3 different ways to clear the option option in the select tag_html/css_WEB-ITnose

3 different ways to clear the option option in the select tag_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:53:46
Original
1113 people have browsed it

This article introduces in detail three different ways to clear the options in the select tag. The specific syntax format is as follows. Interested friends can refer to it. I hope it will be helpful to everyone

Method 1

Copy code

The code is as follows:


document.getElementById("selectid").options.length = 0;


Method 2

Copy code

The code is as follows:


document.formName.selectName.options.length = 0;


Method 3

Copy code

The code is as follows:


document.getElementById("selectid").innerHTML = "";

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template