danielrvt
danielrvt

Reputation: 10926

Jquery mobile not a selectmenu object

I'm using jquery mobile and have a select menu in my html markup like this:

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

I actually would like to add some more options after an ajax call, so I do something like:

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

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

But sometimes I get an error that says that the object has no method 'selectmenu'. Why is this happening?

Upvotes: 3

Views: 412

Answers (1)

Andr&#233; Pedroso
Andr&#233; Pedroso

Reputation: 1664

try the following:

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

http://forum.jquery.com/topic/how-to-add-items-and-refresh-the-select-menu-in-jquery-mobile

Upvotes: 1

Related Questions