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()); });
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.
On an Access form, use the Date Picker to enter the current date. If the field is set up as a Date/Time field, the Date Picker icon appears when you click in the field. Click the icon, and then click the Today button below the calendar.
format String (default: "M/d/yyyy") Specifies the format, which is used to format the value of the DatePicker displayed in the input. The format also will be used to parse the input. For more information on date and time formats please refer to Date Formatting.
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); });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With