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

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

本文为大家详细介绍下使用3种不同方式来清空select标签中option选项,具体语法格式如下,感兴趣的朋友可以参考下哈,希望对大家有所帮助

方法一

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

方法二

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

方法三

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