JavaScript, jQuery, jQuery Mobile

jQuery Mobile: Set Selected Item for jQM Select

There’s a minor different how to set selected item in drop down list in jQuery Mobile. We can’t set by using standard jQuery $().val(value);. Here the workaround

$("#selector option[value='your-value']").attr('selected', 'selected');  
$('#selector').selectmenu('refresh');

Reference: Is there a way to set the selected value in JQM select?

Leave a Reply

Your email address will not be published. Required fields are marked *

four × 5 =