jquery - 带有 Bootstrap 的 mvc 下拉列表

标签 jquery css asp.net asp.net-mvc twitter-bootstrap

我想要可搜索的下拉列表 like this link .

我正在使用 ASP.NET MVC

<td class="input">
    <select id="classLessonSelect">
        @foreach (Student student in Model) {
            <option value=@student.id>@student.Name @student.Surname</option>
        }
     </select>
</td>

我做不到,如何将其集成到我的代码中?

最佳答案

您是否考虑过使用像 Select2 https://select2.github.io/ 这样的插件? .它有很多选项,其中之一是可搜索的选择。设置很容易,例如

$("#selectId").select2();

关于jquery - 带有 Bootstrap 的 mvc 下拉列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36856841/

相关文章:

html - 仅CSS的砌体布局

html - 奇怪的 CSS3 边距问题

ASP.NET 日志记录 - log4net 或运行状况监控?

asp.net - 本地化 .NET Web 应用程序的最佳方式(服务器端和客户端)

javascript - jQuery 中基于过滤器的排序

javascript - Pacta.js 中 $.when 的代数实现

javascript - jQuery 中的切换功能

javascript - CSS 选择器可以使用 nth-child,但不能使用 last-child

c# - 在下拉列表中显示层次结构

javascript - 将表示毫秒的字符串转换为日期