Trying to get .data("kendoDateTimePicker") on declaratively initialized element

3 posts, 1 answers
  1. 100%
    100% avatar
    75 posts
    Member since:
    Apr 2013

    Posted 21 Feb 2014 Link to this post

    I am initializing a datetimepicker element declaratively like this:

    <input id="foo" name="start" type="text" data-role="datetimepicker" />

    when I later on try to get a refence to the datetimepicker object, I use

    var dtp = $('#foo').data('kendoDateTimePicker');

    but all I get is null. How come?
  2. 100%
    100% avatar
    75 posts
    Member since:
    Apr 2013

    Posted 21 Feb 2014 Link to this post

    It seems like the only key I have in .data is "role" which is "datetimepicker".
  3. Kendo UI is VS 2017 Ready
  4. Answer
    Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 21 Feb 2014 Link to this post

    Hi,

    The code you have shown looks correct. Here is a live demo that show a running version of it: http://jsbin.com/jepowazi/1/edit

    Regards,
    Atanas Korchev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top