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
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./kendo-ui/api/web/datepicker
Share Improve this question edited Jan 18, 2017 at 22:44 Rob Lyndon 12.7k5 gold badges54 silver badges79 bronze badges asked Apr 4, 2014 at 18:27 MandoMando 11.7k17 gold badges90 silver badges178 bronze badges2 Answers
Reset to default 4With the Kendo object you have to use data
like:
var d = $("#datepickerFrom").data("kendoDateTimePicker").value();
See the documentation here.
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