Tuesday, 15 February 2011

How to remove option element in JQuery mobile? -



How to remove option element in JQuery mobile? -

this question has reply here:

html 1st alternative in select not render selected item on page jquery mobile? 1 reply

i have

<select id="zone" name="zone"> <option value="10">australia/sydney</option> <option value="11">australia/melbourne<option> <option value="12">australia/brisbane<option> </select>

i want remove options element can start repopulating options different option.

how do that? looking @ jquery mobile, didn't see selectmenu methods can utilise.

thanks

for removing options can use:

$('#zone').find('option').remove();

you need refresh selectmenu see modified select:

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

and appending new values:

$('#zone').append("<option value='13'>australia/perth</option");

jquery jquery-mobile

No comments:

Post a Comment