刷新selectmenu - TypeError:无法读取未定义的属性'jQuery19105462655627634376'

时间:2013-04-16 20:23:54

标签: javascript jquery typeerror jquery-mobile

鉴于功能:

function pintarTipologias() {
console.log("pintarTipologias");
$('#comboTipologias').selectmenu();
var tipologias = JSON.parse(localStorage.getItem("tipologias"));
if (tipologias != null && tipologias.length > 0) {
    tipologias.forEach(function(tipologia, posicion) {
        $("#comboTipologias").append('<option value=' + tipologia.id +  '>' + tipologia.denominacion + '</option>');
    });
}
$('#comboTipologias').selectmenu();
$('#comboTipologias').selectmenu("refresh");
}

最后一行产生以下错误:

  

TypeError:无法读取未定义的属性“jQuery19105462655627634376”

我在Chrome控制台中写道:

$('#comboTipologias').selectmenu("refresh");
TypeError: Cannot read property 'jQuery19105462655627634376' of undefined
$('#comboTipologias').selectmenu();
[<select id=​"comboTipologias" name=​"comboTipologias" data-mini=​"true" data-native-menu=​"false" multiple=​"multiple" tabindex=​"-1">​…​</select>​]
$('#comboTipologias').selectmenu("refresh");
[<select id=​"comboTipologias" name=​"comboTipologias" data-mini=​"true" data-native-menu=​"false" multiple=​"multiple" tabindex=​"-1">​…​</select>​]

我不明白

1 个答案:

答案 0 :(得分:0)

试试这个:

$('#comboTipologias').selectmenu('refresh', true);