use*_*194 3 javascript jquery jquery-ui
任何正文都可以帮我解决如何在下拉事件更改时清除列表框中的项目.
$(function () {
$("#ddlLevelColumn").change(function () {
$("#lstCodelist") ------ I need to clear this listbox1
$("#lbxSelectedItems")--------------- need to clear list box 2
});
});
<%:Html.ListBox("lstCodelist", Model.CodeListDefaultValue, new { style = "width:99%;height:297px;" })%>
<%:Html.ListBox("lbxSelectedItems", Model.AffectedCodeListboxData, new { style = "width:99%;height:297px;color:blue;" })%>
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助..
Zee*_*der 15
$("#lstCodelist").empty()
$("#lbxSelectedItems").empty()
Run Code Online (Sandbox Code Playgroud)
您可以删除所有条目(或同时应用过滤器):
$('#listBoxId > option').remove(); // all options
$('#listBoxId > option[val!=""]').remove(); // keep non-empty values
Run Code Online (Sandbox Code Playgroud)
你想要的是什么?我相信更简单:
$('#listBoxId').empty();
Run Code Online (Sandbox Code Playgroud)
应该也可以.
工作演示:http://jsfiddle.net/jEWe6/
| 归档时间: |
|
| 查看次数: |
23004 次 |
| 最近记录: |