init

Instantiates Kendo UI widgets in a given DOM element based on role data attributes.

Example

Open In Dojo
 <div id="view">
    <div>
        <input data-role="autocomplete" data-source="data" data-filter="startswith" data-placeholder="select country ..." />
    </div>
 </div>
 <script>
 var data = [ "Albania", "Andorra", "Armenia", "Austria", "Azerbaijan", "Belarus", "Belgium", "Bosnia & Herzegovina", "Bulgaria", "Croatia", "Cyprus"  ];

 kendo.init($("#view"));
 </script>

Parameters

element String|jQuery|Element

The root element(s) from which the instantiation starts. Can be a valid jQuery string selector, a DOM element or a jQuery object. All descendant elements are traversed.

namespace Object (optional)

Optional namespace too look in when instantiating Kendo UI widgets. The valid namespaces are kendo.ui and kendo.dataviz.ui. If omitted kendo.ui will be used. Multiple namespaces can be passed.

Example

Open In Dojo
 <div id="view">
    <div>
        <input data-role="autocomplete" data-source="data" data-filter="startswith" data-placeholder="select country ..." />
        <button data-role="button" data-click="foo">Foo</button>
    </div>
 </div>

 <script>
 function foo(e) {
/* The result can be observed in the DevTools(F12) console of the browser. */
     console.log(e.sender); // a button
 }
 var data = [ "Albania", "Andorra", "Armenia", "Austria", "Azerbaijan", "Belarus", "Belgium", "Bosnia & Herzegovina", "Bulgaria", "Croatia", "Cyprus"  ];

 kendo.init($("#view"), kendo.ui);
 </script>
In this article