javascript - 使用 javascript 从列表框中删除(取消选择)所选项目

标签 javascript listbox

我试过这个,

document.getElementById('<% = ListBox1.ClientID %>').options.length = 0;这样做的作用是清除列表框中的项目..我只是想取消选择所选的项目..任何建议...

最佳答案

代码

ListBox1.selectedIndex = -1;

关于javascript - 使用 javascript 从列表框中删除(取消选择)所选项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3300343/

相关文章:

javascript - 在移动设备上隐藏类或 javascript 链接

javascript - Jqueryeach和split问题

javascript - Jquery Array - 如何将多个索引初始化压缩为一行代码

vba - Excel 多选、多列列表框

c# - 数据绑定(bind) ListBox SelectedItems 属性

javascript - 计算两个旋转度数的绝对距离,作为数字(在 JavaScript 中)

javascript - 如何在不导入模块的情况下运行它?

python - tkInter 列表框上的隐藏 id

c# - 如何将List中的数据插入到ListBox中?

wpf - ListBox 中的 TextBox、Button 和 ListBox