Javascript Jquery mobile不是selectmenu对象

Javascript Jquery mobile不是selectmenu对象,javascript,jquery-mobile,Javascript,Jquery Mobile,我正在使用jquery mobile,在html标记中有一个选择菜单,如下所示: <select id="theid"> <option>foo</option> ... </select> 福 ... 实际上,我想在ajax调用之后添加更多选项,因此我会执行以下操作: $('#theid').append( $('<option val="42">').text('bar') ) $('#theid')

我正在使用jquery mobile,在html标记中有一个选择菜单,如下所示:

<select id="theid">
    <option>foo</option>
    ...
</select>

福
...
实际上,我想在ajax调用之后添加更多选项,因此我会执行以下操作:

$('#theid').append(
    $('<option val="42">').text('bar')
)

$('#theid').selectmenu('refresh');
$('#theid')。追加(
$('').text('bar')
)
$('#theid')。选择菜单('刷新');
但有时我会遇到一个错误,说对象没有“selectmenu”方法。为什么会这样

尝试以下操作:

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