欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  web前端

清空select标签中option选项的3种不同方式_HTML/Xhtml_网页制作

程序员文章站 2022-03-31 10:51:13
...
方法一

复制代码
代码如下:

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

方法二

复制代码
代码如下:

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

方法三

复制代码
代码如下:

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