I’m trying to disable the multiselect in my listbox, but when I call removeAttr(‘multiple’), it turns my listbox into a dropdownlist. I don’t want a dropdown, I want to keep the listbox. How can I adjust to make this happen? Thanks.
@Html.ListBox("ListBoxName", new SelectList((IEnumerable<Epic>)ViewData["selectedestimate"], "Id", "Name", "EstimatedTime"), new {@class = "ListBoxClass", @style = "height: 325px;", @id = "epiclistbox"})
<script type="text/javascript">
$(document).ready(function () {
$('select').removeAttr('multiple');
});
What you need is set the
sizeattribute to theSELECTelement like this: