2

Those approaches don't work:

dateSelectedFrom = $("#datepickerFrom").value - undefined
dateSelectedFrom = $("#datepickerFrom").value() - object has no method value()

I know that I can use this.value() and it is works fine, but the method onDateSelectedFromCalendar is used by a different dateTimePicker control (I have several on the page)

<input id="datepickerFrom" value="10/10/2011" />

   $("#datepickerFrom").kendoDatePicker({
            change: onDateSelectedFromCalendar
        });

   function onDateSelectedFromCalendar(e) {
        dateSelectedFrom = $("#datepickerFrom").value;
    }

Documentation doesn't specify any other options http://docs.telerik.com/kendo-ui/api/web/datepicker

Rob Lyndon
  • 12,089
  • 5
  • 49
  • 74
Mando
  • 11,414
  • 17
  • 86
  • 167

2 Answers2

4

With the Kendo object you have to use data like:

var d = $("#datepickerFrom").data("kendoDateTimePicker").value();

See the documentation here.

jwatts1980
  • 7,254
  • 2
  • 28
  • 44
1

You can have all the datepickers calling the same onChange event using the below:

function onDateSelectedFromCalendar(e) {
    dateSelectedFrom = e.sender.value();
}

if you wanted to be able to distinguish which element triggered the function you could use:

e.sender.element[0].id

which will give you the Id of the element.

Lastly

e.sender

will give you the same as

$('#datepickerFrom').data().kendoDatePicker

Check their DatePicker api Here

MattOG
  • 375
  • 3
  • 7