This is a migrated thread and some comments may be shown as answers.

Get element ID from change event handler?

1 Answer 1861 Views
NumericTextBox
This is a migrated thread and some comments may be shown as answers.
Trevor
Top achievements
Rank 1
Trevor asked on 07 Mar 2013, 09:32 PM
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.

1 Answer, 1 is accepted

Sort by
1
Alexander Valchev
Telerik team
answered on 08 Mar 2013, 08:50 AM
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!
Tags
NumericTextBox
Asked by
Trevor
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or