这是我的日期选择器的代码:
<div class="editor-field">
@(Html.Kendo().DatePickerFor(model => model.Date)
.HtmlAttributes(ViewBag.Disabled ? (object)new { @class = "formDatePicker", disabled = "disabled", @id = "Date", style = "width:150px", placeholder = "Select Date" } : new { @class = "formDatePicker", @id = "Date", style = "width:150px", placeholder = "Select Date" })
.Events(e => e.Open(@<text>function(e){BrowserCompatibility.DisableDatePickerYearsOnSomeBrowsers(e);}</text>))
.Format(@HCulture.GetShortDateFormat())
.Events(e => e.Change(@<text>function(e){
$("#DateString").val($('#Date').val());
checkInputValid();
}</text>))
)
</div>
我尝试了这个解决方案,但没有奏效:
var datePicker = $("#Date").data('kendoDatePicker');
datePicker.input.val(input.attr('placeholder'));