Get element ID from change event handler?

2 posts, 0 answers
  1. Trevor
    Trevor avatar
    5 posts
    Member since:
    Oct 2012

    Posted 07 Mar 2013 Link to this post

    I have a page that will have a dynamically created number of Kendo NumericTextBox items (in a grid). Each of those has a unique ID, and I need to discover in the change event handler which box is being changed. It is impossible to pass a custom parameter to the event handler (otherwise, I would simply pass the relevant part of the ID as a parameter). The demos and documentation are completely unhelpful, as while they outline the change event handler, there is no code to show how to

    Things I have tried:
    this.id
    this.name
    this.attr("id")
    $(this).id
    $(this).name
    $(this).attr("id")
    e.target

    The specific question is this: how can I discover the ID of the NumericTextBox that fired the change event?
    The general question is this: where can I find documentation on the properties and methods of the event argument parameter?

    Thanks.
  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2877 posts

    Posted 08 Mar 2013 Link to this post

    Hello Trevor,

    Thank you for getting in touch with us.

    All widget events are called within the context of the corresponding widget, in other words 'this' keyword points to the widget's client object.
    var onChange = function(e) {
        var inputId = this.element.attr("id");
    }

    To get the html element from which the widget is initialized you may use the 'element' property.

    Currently properties of the widget are not documented, but this task is already scheduled. We will also consider also to improve the event data list and/or to provide more code snippet examples.

    Kind regards,
    Alexander Valchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
Back to Top