


3 different ways to clear the option option in the select tag_html/css_WEB-ITnose
Jun 24, 2016 am 11:53 AM
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 = "";

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Difficulty in updating caching of official account web pages: How to avoid the old cache affecting the user experience after version update?

How do I use HTML5 form validation attributes to validate user input?

What is the purpose of the <iframe> tag? What are the security considerations when using it?

How to efficiently add stroke effects to PNG images on web pages?

What is the purpose of the <meter> element?

What is the purpose of the <datalist> element?

What is the viewport meta tag? Why is it important for responsive design?

What are the security implications of using iframes, and how can I mitigate them?
