Проблема, с которой вы сталкиваетесь, заключается в том, что вам нужно «обновить» виджет <select>
, используя .selectmenu('refresh')
:
var temp = ['5.00', '10.00', '15.00', '25.00', '50.00', '100.00'],
output = [];
//notice I cached the `temp.length` value, the `for` loop will perform faster if this is done
for(var i = 0, len = temp.length; i < len; i++){
//instead of appending each `<option>` element, it is a better practice to either concoct a string of all the HTML or create an array that will later be turned into a string (here we are pushing new indexes onto an `output` array)
output.push('<option value="' + temp[i]+'">' + temp[i] + '</option>');
}
//now make a single `.append()` call with all the HTML in one big string
//and most importantly, call `.selectmenu("refresh")` after we update the HTML of the select menu so the jQuery Mobile framework will update the widget
$('#amountsList').append(output.join('')).selectmenu('refresh');
Вот демонстрационная версия: http://jsfiddle.net/TtguK/9/