This question is locked. New answers and comments are not allowed.
I have a dropdownlist defined as follows:
<kendo:dropDownList name="module" dataTextField="domainValue" dataValueField="domainId"> <kendo:dataSource data="${testModule}"></kendo:dataSource> </kendo:dropDownList>
The html generated in the browser is as follows:
<span class="k-widget k-dropdown k-header" style="" title="" unselectable="on" role="listbox" aria-haspopup="true" aria-expanded="false" tabindex="0" aria-owns="module_listbox" aria-disabled="false" aria-busy="false" aria-activedescendant="b5f28c08-1663-4dfc-bebe-a03898405acf"><span class="k-dropdown-wrap k-state-default" unselectable="on"><span class="k-input" unselectable="on">Library</span><span class="k-select" aria-label="select" unselectable="on"></span><input id="module" name="module" data-role="dropdownlist" style="display: none;"></span><script>jQuery(function(){jQuery("#module").kendoDropDownList({"dataSource":{"data":[{"domainId":17,"domainValue":"Library","domainCode":"TMOD"},{"domainId":18,"domainValue":"Regular","domainCode":"TMOD"},{"domainId":19,"domainValue":"Advanced","domainCode":"TMOD"},{"domainId":20,"domainValue":"Unknown","domainCode":"TMOD"}]},"dataValueField":"domainId","dataTextField":"domainValue"});})</script>
Then in a $(document).ready function I have the following:
var dropdownlist = $('#module').data("kendoDropDownList");dropdownlist.select(function(dataItem) { return dataItem.value === "Regular";});
The second line throws a javascript error because the variable dropdownlist is not defined.
Note I have 3 other dropdownlists defined on the page, all with different names, obviously, and get the same error.
Please tell me where I'm going wrong. Thank you.