I want To Set Date From Date Picker using JavaScritp /Jquery in Console

1 Answer 56 Views
Date/Time Pickers DateInput DateRangePicker
Hafsa
Top achievements
Rank 1
Hafsa asked on 05 Dec 2023, 04:28 AM

Here is HTML Code of Date Picker

 

<input kendo-date-picker="" k-scope-field="dteNewDueDateDate" k-format="'yyyy-MM-dd'" k-on-change="undefined" custom-date="" ng-model="vm.target.newDueDate" required="" ng-class="{ 'is-invalid': (changeDueDateForm.dteNewDueDateDate.$dirty || changeDueDateForm.$submitted) &amp;&amp; changeDueDateForm.dteNewDueDateDate.$error.required }" ng-disabled="false" aria-label="New Due Date" name="dteNewDueDateDate" id="dteNewDueDateDate" entity="undefined" field="undefined" config="" class="ng-pristine ng-untouched k-input-inner ng-empty ng-invalid ng-invalid-required" data-role="datepicker" type="text" role="combobox" aria-expanded="false" aria-haspopup="grid" aria-controls="dteNewDueDateDate_dateview" autocomplete="off" aria-disabled="false" aria-readonly="false" aria-invalid="true" style="">

 

I have Tried this and Similar Solutions but all in Vain. Please help me to find its solution

$(document).ready(function() {   // Wait for the document to be fully loaded   // Initialize the Kendo UI DatePicker  $("#dteNewDueDateDate").kendoDatePicker({     format: "yyyy-MM-dd"    // Add any other configuration options you need  });   // Set the value after initialization  setTimeout(function() {     var datePicker = $("#dteNewDueDateDate").data("kendoDatePicker");     var targetDate = new Date('2023-12-04');     datePicker.value(targetDate);     datePicker.trigger("change");   }, 100); // Adjust the timeout duration if needed});

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 07 Dec 2023, 03:32 PM

Hello Hafsa,

From the provided information I am not sure if you are using the AngularJS directives or you initializing the Kendo components using the standard initialization with the data() method. However, please note that as mentioned in the article linked here, starting with R2 2022, the Kendo UI team officially drops the support for AngularJS 1.x through Kendo UI for jQuery. 

I tested the provided code snippet in the Dojo linked here and as you will see the value of the DatePicker is set as expected. Please let me know if I am missing something. 

Regards,
Neli
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources
Tags
Date/Time Pickers DateInput DateRangePicker
Asked by
Hafsa
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or