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

Determining the Combobox Name in jquery

1 Answer 109 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Neil
Top achievements
Rank 1
Neil asked on 04 Jan 2017, 09:53 PM

I have a form with multiple combo boxes, all have the same OnSelect event.

When I call the OnSelect I need to determine which combo box actually fired the event.

 

Here is my OnSelect function...

function combo_OnSelect(e) {
        var dataItem = this.dataItem(e.item.index());
        var control =  $(this).val();
        if (dataItem.Value == "Lookup") {
            var dialog = $("#window_Lookup").data("kendoWindow")
            dialog.center().open();
        }
    }

The bolded part throws an error, so what is the correct way to determine the combo box name?

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 05 Jan 2017, 03:23 PM
Hello Neil,

The widget's id(name) can be retrieved from its element. So in the ComboBox select event handler you can access it like this:
var id = this.element.attr("id");

Regards,
Ivan Danchev
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.
Tags
ComboBox
Asked by
Neil
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or