kendo dropdown list select option label by default

Ashwin picture Ashwin · May 6, 2014 · Viewed 15.7k times · Source

I have a dropdown list created using kendo library. I have added a option label default text which I want to show on load by default. If I use a select element to initialize a dropdown it does not work nicely but when I use input type as text then it work.

HTML:

<select id="size">
    <option>S - 6 3/4"</option>
    <option>M - 7 1/4"</option>
    <option>L - 7 1/8"</option>
    <option>XL - 7 5/8"</option>
</select>

JS:

$("#size").kendoDropDownList({
    optionLabel: " -- Select -- "
});

Here is the jsfiddle: http://jsfiddle.net/42DkV/

Answer

Try

.select()

$("#size").kendoDropDownList({
    optionLabel: " -- Select -- "
}).data("kendoDropDownList").select(0); //select(index) , index starts from 0 

Fiddle Demo