Kendo calendar selected date event

2019-02-27 21:18发布

问题:

Hi I've a kendo calendar and a text box in my page. When I select any date on the calendar, I wanted to show that value in my textbox. (like datetime picker). Any way to get it?

Here is my sample code

<div id="calendar"></div>
<input type="text" name="txtdate" id="txtdate"/>

 <script>
                $(document).ready(function() {
                    // create Calendar from div HTML element
                    $("#calendar").kendoCalendar();
                });

                var cal = $("#calendar").data("kendoCalendar");

                cal.bind("change", function () {
                    // Here I wanted to bind the selected value to my text box (txtdate).                      
                });
  </script>

回答1:

   var textVal =  $(this).value();
   $('#txtdate').val(textVal);