Is there a way to determine what kind of kind of control you have using JavaScript. For example , if you have a form with several different kendo controls
.data("kendoNumericTextBox")
.data("kendoComboBox")
.data("kendoButton")
I only have the name and id of the control. Is there a way to determine what kind of kendo control that is represented.
I have tried looking through the jquery selection but I do not see any thing that indicates whether the selection is a kendoNumericTextBox, kendoComboBox etc...
Hi Sean,
In order to achieve the desired behavior, I would recommend trying a custom implementation as the following:
function getKendoWidgetType(element) { var kendoWidgets = [ 'kendoNumericTextBox', 'kendoComboBox', 'kendoButton', // Add other Kendo widgets you want to check for ]; for (var i = 0; i < kendoWidgets.length; i++) { var widgetName = kendoWidgets[i]; if ($(element).data(widgetName)) { return widgetName; } } return null; } var element = $('#myControlId'); // Replace with your control's id or selector var widgetType = getKendoWidgetType(element); if (widgetType) { console.log('The control is a: ' + widgetType); } else { console.log('No Kendo widget found on the element.'); }
I hope this example helps.
Kind Regards,
Anton Mironov