云岭逸人

关注

清空select标签中option选项的3种不同方式

云岭逸人

关注

阅读 213

2022-08-31

方法一

代码如下:
document.getElementById("selectid").options.length = 0;

方法二

代码如下:
document.formName.selectName.options.length = 0;

方法三

代码如下:
document.getElementById("selectid").innerHTML = "";


其他方法:
var nian = document.getElementById("nian");
var length = nian.options.length;

for(var i=0; i < length; ){
//nian.options.remove(i);
//length=length/2;
}


相关推荐

你带来了我的快乐

JavaScript创建对象的3种不同方式

你带来了我的快乐 223 0 0

古得曼_63b6

java select option 清空 js

古得曼_63b6 13 0 0

凌得涂

jsp在select中的option中编写if标签

凌得涂 277 0 0

Alex富贵

elementUI select,option变化,如果option不存在上次的选项,自动清空上次的选择

Alex富贵 27 0 0

古得曼_63b6

element ui 中form的select option 中怎么禁用某些选项?

古得曼_63b6 83 0 0

落花时节又逢君to

通过BeanDefinitionReader获取BeanDefinition的三种不同方式

落花时节又逢君to 101 0 0

忍禁

麒麟KYLINOS使用五种不同方式安装软件

忍禁 104 0 0

boom莎卡拉卡

html中select标签的选项携带多个值

boom莎卡拉卡 21 0 0

吓死我了_1799

Flink中序列化RoaringBitmap不同方式的对比

吓死我了_1799 39 0 0

Star英

js获取select选中的标签option的值

Star英 38 0 0

精彩评论(0)

0 0 举报