Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Kendo combobox placeholder text in javascript has no effect

  • MVC 5.2.2
  • Razor 3.2.2
  • Kendo MVC UI v2014.2.903

In Javascript, when I want to change the placeholder text of a ComboBoxFor, I thought I could do:

@model MyNameSpace.Models.Address

@(Html.Kendo().ComboBoxFor(model => model.ZipCode)
    .Placeholder("Select Zip...")
    .DataTextField("Text")
    .DataValueField("Text")
    .Suggest(true)
    .BindTo(Model.MailCodes)
)

the javascript I use....

 $("#Address_ZipCode").data("kendoComboBox").options.placeholder = "Select Postal...";

But this doesn't seem to affect the dropdownlist placeholder text at all.

What's the correct way do do this?

Here is my Kendo UI JSFiddle:

http://jsfiddle.net/devfingers/qy85emc8/5/

like image 265
Robert Achmann Avatar asked Oct 02 '14 21:10

Robert Achmann


1 Answers

The awesome people at Telerik helped me:

$("#Address_ZipCode").data("kendoComboBox").input.attr("placeholder", "Select Postal...");

like image 198
Robert Achmann Avatar answered Sep 30 '22 06:09

Robert Achmann