将今天日期设置为kendo datepicker [英] Set Today date to kendo datepicker

查看:342
本文介绍了将今天日期设置为kendo datepicker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在清除按钮点击时将今天日期设置为Kendo DatePicker。我试过以下但是没有用。

I want to set today date to Kendo DatePicker on clear button click. I tried following but it is not working.

$('#btnClear').click(function () {
  $("#StartDate").data("kendoDatePicker").value(new Date());
});

以上代码不会出现任何错误,也不会设置今天的日期。它清除了kendo DatePicker的文本框值。
注意:Kendo DatePicker格式是MM / dd / yyyy。

Above code don't give any error and don't set today date. It clears kendo DatePicker's textbox value. Note: Kendo DatePicker format is MM/dd/yyyy.

推荐答案

我试过以下并且对我很有效。

I tried following and works perfectly for me.

$('#btnClear').click(function () {
  var todayDate = kendo.toString(kendo.parseDate(new Date()), 'MM/dd/yyyy');
  $("#StartDate").data("kendoDatePicker").value(todayDate);
});

这篇关于将今天日期设置为kendo datepicker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆