我的 mvc 应用程序需要一些帮助。
我使用以下代码创建 Kendo TimePicker。
@(Html.Kendo().TimePicker().Name("FirstShiftFrom" + prop.PropertyName.Substring(0, 3))
.HtmlAttributes(new { @class = "workHoursTimePicker " + prop.PropertyName ,@disabled = "disabled" ,style="width:85px"})
如何启用此控件?
我在js中尝试过这个:
document.get.Element.By.Id("id").disabled = false;
但它不起作用!
最佳答案
不要使用 HTML disabled 属性来禁用 Kendo 时间选择器,而是使用 Kendo 时间选择器小部件的 Enable 方法。
例如
@(Html.Kendo().TimePicker().Name("FirstShiftFrom" + prop.PropertyName.Substring(0, 3))
.HtmlAttributes(new { @class = "workHoursTimePicker " + prop.PropertyName, style = "width:85px" })
.Enable(false))
这将禁用时间选择器并在 JavaScript 中使用它来启用它:
$("#TimePickerId").data("kendoTimePicker").enable(true);
希望这有帮助!
关于javascript - 如何更改Kendo TimePicker的禁用属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29196143/