Determining the Combobox Name in jquery

2 posts, 0 answers
  1. Neil
    Neil avatar
    18 posts
    Member since:
    Aug 2016

    Posted 04 Jan Link to this post

    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?

  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    1092 posts

    Posted 05 Jan Link to this post

    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.
Back to Top