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

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -