Kendo ui 如何将k-state-error类添加到剑道日期选择器
我需要在剑道日期选择器的onChange事件中添加k-state-error类Kendo ui 如何将k-state-error类添加到剑道日期选择器,kendo-ui,Kendo Ui,我需要在剑道日期选择器的onChange事件中添加k-state-error类 function onChange(e) { if (e.date == undefined) { $(this).closest('span').addClass("myclass"); $(this).parent('span').addClass("myclass"); $(this).child('span').addClass("myclass");
function onChange(e) {
if (e.date == undefined) {
$(this).closest('span').addClass("myclass");
$(this).parent('span').addClass("myclass");
$(this).child('span').addClass("myclass");
}
}
我怎样才能访问它 内部
change
事件处理程序$(此)
指的是DatePicker
,而不是原始的输入。因此,您应该使用$(this.element)
$("#date").kendoDatePicker({
change: onChange
}
});
function onChange(e) {
if (!e.sender.value()) {
$(this.element).closest('span').addClass("myclass");
$(this.element).parent('span').addClass("myclass");
// NOTE: The following will actually not work since it does not have child
// $(this.element).child('span').addClass("myclass");
}
}
编辑:并将样式定义为:
.myclass {
border: 3px solid red !important;
}
此处运行示例:此示例没有将红色边框添加到我的日期选择器?