清除JavaScript中的dropdownlist [英] clear dropdownlist in javascript

查看:65
本文介绍了清除JavaScript中的dropdownlist的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hiiii all,

我有两个dropdownlist(或在html中选择).一个取决于第二个.
当其选择索引的第一个更改时,它会将其数据放在旧数据上.
我想清除旧数据,然后填充新数据.
所以,有人可以帮我吗?

谢谢

hiiii all,

I have two dropdownlist(or select in html) . one depends on the second.
when the first on its select index change , it puts its data on the old data.
I want to clear the old data and then fill new data.
So, Can any onehelp me in that.

Thanks

推荐答案

在填写新项目之前执行此操作
Do this before you fill in the new items
document.getElementById("myDropdown").options.length = 0;


这篇关于清除JavaScript中的dropdownlist的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆