更新后“刷新" jQuery UI选择菜单 [英] 'refresh' jquery UI selectmenu after update
本文介绍了更新后“刷新" jQuery UI选择菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个get请求,该请求获取一堆类别信息以填充<select>
.我正在使用jQuery UI Selectmenu设置我的选择的样式.
I have an get request which fetches a bunch of category information to populate a <select>
. I'm using jQuery UI Selectmenu to style my select.
所以我的jQuery看起来像这样:
So my jQuery looks a little like this:
//Initalise the selectmenu
$("select").selectmenu({ style: 'dropdown' });
$.get("http://localhost/somedata?cat=2", function (data) {
$.each(data, function (index, itemData) {
$("<option value='" + itemData.Id + "'>" + itemData.Name + "</option>").appendTo("#selectList");
});
});
但是,这会填充<select>
,但不会更新jQuery UI选择菜单.有什么想法我需要做些什么才能使选择菜单重新绘制",以便新值出现在选择菜单中?
However this populates the <select>
but does not update the jQuery UI selectmenu. Any ideas what I need to do to get the selectmenu to be 're-drawn' so the new values appear in the selectmenu?
推荐答案
查看全文