I have a drop down list(select list) with ID TestList
.
I want to use this as selectmenu
from jQuery UI. This drop down is getting dynamically populated so initially there are no options to this select list.
In the scripts section, I am first initializing the select list with select menu as:
$("#TestList").selectmenu();
Next, I want to dynamically populate it with data, so I am doing this:
for (var i = 0; i < data.length; i++) {
$('#TestList').val(data[i]);
$("#TestList").selectmenu("refresh");
}
But the problem is, it throws Uncaught Error: no such method 'instance' for menu widget instance.
I followed How to select an option in a jQuery ui selectmenu dynamically? but the problem still persists. I am using the latest jQuery UI package(jquery-ui-1.12.1.custom) and jQuery 1.9 Please help me solve this issue.. List: