我正在製作一個jQuery Mobile和PhoneGap應用程序。我正在動態加載選擇菜單的選項。我希望第一個選項是我的選擇菜單的默認「值」。追加後,我有我所有的選擇,但沒有選擇。我嘗試刷新和設置值屬性,但它不起作用。下面是我的javascript:設置默認值od選擇菜單
function customerList(data)
{
var html ='';
console.log('Start');
$.each(data, function(key, value){
html += '<option value="'+ data[key].id + '">' + data[key].label + '</option>';
$('#customer').append($(html));
html='';
});
$('#customer').selectmenu();
}
您在哪裏設置您的'
我在pageinit事件中設置了值。 –