Kendo Date Picker selection by class name with JQuery

2 posts, 0 answers
  1. Richard
    Richard avatar
    9 posts
    Member since:
    Jun 2016

    Posted 22 Mar Link to this post

    How do i get the value of a Kendo Date Picker by class name. The reason being is because im using the name and id attributes for something else. As you can see below the class attribute is dynamic. Every other time ive selected a Kendo Date Picker, i've always used the ID attribute. Is it possible to select by class attribute?

    @Html.Kendo().DatePicker()
                  .Name("SurveyResponse.DateRes[" + @guid + "].Date")
                  .Format("MM/dd/yyyy")
                  .HtmlAttributes(new {
                           onkeydown = "javascript:return false;",
                           onblur = "ConditionalTextBox(" + @item.SurveyQuestionID + ",'datecontrol')",
                           @placeholder = "Your answer",
                           @required = "required",
                           @class = "IsConditionalTextBox_" + @item.SurveyQuestionID
                           })
  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2136 posts

    Posted 24 Mar Link to this post

    Hello Richard,

    It is not mandatory to use the ID of the input element when you need to get reference to the API of the widget and you can use any selector that will find the corresponding INPUT element. Here is a simple example with custom class name:
    $(".yourClassName.k-input").data("kendoDatePicker")

    Please feel free to contact us again if other questions arise on this matter.


    Regards,
    Konstantin Dikov
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top