plugin

Helper method for writing new widgets. Exposes a jQuery plug-in that will handle the widget creation and attach its client-side object in the appropriate data-* attribute.

Example

<input />
<script> 
  var CustomTextBox = kendo.ui.Widget.extend({
    options: {
      name: "CustomTextBox"
    },
    value: function (value) {
      if (value !== undefined) {
        this.element.val(value);
      } else {
        return this.element.val();
      }
    }
  });

  kendo.ui.plugin(CustomTextBox);

  // initialize a new CustomTextBox for each input, with the given options object.
  $("input").kendoCustomTextBox({ });
  // get the CustomTextBox object and call the value API method
  $("input").data("kendoCustomTextBox").value("some value");
</script>

Parameters

widget kendo.ui.Widget

The widget function.

register Object (default: kendo.ui)

The object where the reference to the widget is recorded.

prefix String (default: "")

The plugin function prefix, e.g. "Mobile" will register "kendoMobileFoo".

In this article