select next option in jquery selectmenu -
trying create button goto next option in selectmenu has $selectmenu assigned it.
$('option:selected', 'select').removeattr('selected').next('option').attr('selected', 'selected');
works on standard html select menu not when has jquery $selectmenu assigned it.
$('select#toolmenu').selectmenu({ style:'popup', width: 600, menuwidth: 600, maxheight: 400, format: addressformatting, change: function () { var val = this.value; window.location=val; } });
any idea how can control selectmenu?
any appreciated...
dan.
you should use plugin value
method.
$("select#toolmenu").selectmenu("value", theindex);
where theindex
0 based index of options
please note if modifying @ runtime <option>
list inside select have destroy , create plugin scratch. following function example ajax call update option list of select element
$.ajax({ type: "post", datatype: "json", url: 'your_url', async: false, data: {}, beforesend: function() { $("#myselect").selectmenu('disable'); }, success: function (response) { $('#myselect').html(''); $.each(response, function (i, data) { $('#myselect').append($("<option></option>").attr("value", data.value).text(data.text)); }); $('#myselect').selectmenu('destroy').selectmenu(); } });
Comments
Post a Comment