The following script renders required field background color of Kendo UI combobox control. Although this script works perfectly fine, I find it hard to understand it.
From what I can tell, it starts off with attaching custom property or method
so called _input
to Kendo ui combobox object and assign into new variable _originalFunction
but rather than using this variable it's using this chained object again in the next line which I don't really get and assign returned result into this
from an anonymous function that listens to an event.
In general, I don't really get what is happening inside this function and what the returned value would be.
Can someone please explain in a way I can understand?
(function ($) {
var _originalFunction = kendo.ui.ComboBox.fn._input;
kendo.ui.ComboBox.fn._input = function (e) {
var result = _originalFunction.call(this, e);
if (this.input) {
this.input.addClass('required');
}
return result;
}
})(jQuery);