New to Kendo UI for jQuery? Download free 30-day trial

Creating Multiple Widgets Throws JavaScript Errors

Environment

Product Progress® Kendo UI® for jQuery
Kendo Version 2017.2.621

Description 

JavaScript errors are thrown when I create multiple widgets.

Cause

The issue will arise if two or more widgets are initialized from elements that have the same IDs. jQuery will find only the first one every time it searches for it and thus try to initialize the first element in the DOM multiple times.

Solution

Specify a unique ID for each element on the page.

<textarea id="editor"></textarea>
<textarea id="editor"></textarea>
<script>
    $('#editor').kendoEditor();
    $('#editor').kendoEditor(); // problem
</script>
In this article