我正在尝试根据另一个多选下拉列表中的选择来显示/隐藏多选下拉列表中的元素。无论如何,当我使用多选插件 时,我无法显示/隐藏元素。我的代码如下所示:
@Html.DropDownList("CompanyDropDown", new MultiSelectList(ViewBag.CompanyList,
"COD_COMPANY", "DESCRIPTION", null), new
{
multiple = "multiple",
@class = "multiselect",
onchange = "CompanyDropDownOnChange()"
})
@Html.DropDownList("FlowDropDown", new MultiSelectList(ViewBag.ActiveFlow,
"ID_FLOW", "DESCRIPTION", null), new
{
multiple = "multiple",
@class = "multiselect",
})
javascript部分在这里:
jQuery(function ($) {
$("select").multiselect();
});
function CompanyDropDownOnChange() {
$("#FlowDropDown option[value=11]").css('display', 'none');
}
The sample should just hide the flow with id=11 in the second dropdown, when a company in the first dropdown is selected.