jQuery Chosen does not show data-placeholder when it is filled

Viewed 16589

I am using jQuery Chosen plugin in my ASP.NET MVC application. The data-placeholder attribute is not working when the dropdownlist has items in it. Instead of showing default text it automatically selects the first item in the list.

This is how I define my dropdownlist.

@Html.DropDownListFor(m => m.Keep, Model.Data, 
     new { @class = "chzn-select", data_placeholder = "Default..." })

If Model.Data is empty (it is filled in view model using EF), then default text is displayed. Otherwise, the first item is selected. I always want my dropdownlist to show default value.

I apply the plugin via $('.chzn-select').chosen(); Nothing special.

Any ideas ? Thanks in advance.

7 Answers
Related