首页 > 解决方案 > 如何使用文本框创建多选下拉列表

问题描述

我需要使用文本框创建多选下拉列表。在我的下拉列表中,当我单击“其他”选项时,我有“其他”选项,然后我必须在下拉列表中显示文本框以输入自定义值。而且我在第二次点击我的下拉列表时遇到了这个问题。

这是我的 CSHTML 代码:

                @Html.DropDownListFor(m => m.TrainingToolValue, new MultiSelectList(Model.TrainingTool, "TrainingToolID", "ToolName"), new { @id = "TrainingToolId", @class = "form-control", multiple = "multiple" })

这是我的脚本代码

    <script type="text/javascript">

$(document).ready(function () {
    $("#TrainingToolId").multiselect({
        includeSelectAllOption: true,
    });
}); </script>

是否有可能在下拉列表中添加文本框

标签: c#asp.net-mvcrazorasp.net-core-mvc

解决方案


推荐阅读