In jQuery mobile 1.3.1, how do you set the selected value to selectmenu?

I have tried many things. Nothing seems to work.

eg:

$('#select').val(myval).selectmenu('refresh'); $('#select').val(myval).attr('selected', 'selected'); $('#select').val(myval).prop('selected',true); 
+6
source share
1 answer
 $('#select').val(myval).selectmenu('refresh'); 

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

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

+20
source

Source: https://habr.com/ru/post/946643/


All Articles