Home >Web Front-end >HTML Tutorial >3 different ways to clear the option option in the select tag_HTML/Xhtml_Webpage Production

3 different ways to clear the option option in the select tag_HTML/Xhtml_Webpage Production

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 16:40:051601browse

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 = "";
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