Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In jquery mobile 1.3.1 how do you set selected value in a selectmenu?

I have tried numerous things. Nothing seems to work.

for example:

$('#select').val(myval).selectmenu('refresh');
$('#select').val(myval).attr('selected', 'selected');
$('#select').val(myval).prop('selected',true);
like image 666
Seth Avatar asked Jun 06 '13 04:06

Seth


1 Answers

$('#select').val(myval).selectmenu('refresh');

Just make sure myval actually matches a value in your options: <option value="myval">My value</option>

http://jquerymobile.com/demos/1.0a4.1/docs/forms/forms-selects.html

like image 71
thefrontender Avatar answered Nov 12 '22 05:11

thefrontender