87,910
社区成员
发帖
与我相关
我的任务
分享
select1.selectedIndex = i;
<div class="ui-select">
<div id="select1-button" class="ui-btn ui-icon-carat-d ui-btn-icon-right ui-corner-all ui-shadow ui-first-child">
<span>text2</span>
<select id="select1">
<option value="value1">text1</option>
<option value="value2">text2</option>
<option value="value3">text3</option>
</select>
</div>
</div>
select1.previousSibling.innerHTML = select1.options[i].text;
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<link rel="stylesheet" href="http://demos.jquerymobile.com/1.4.5/css/themes/default/jquery.mobile-1.4.5.min.css">
<script src="http://demos.jquerymobile.com/1.4.5/js/jquery.js"></script>
<script src="http://demos.jquerymobile.com/1.4.5/js/jquery.mobile-1.4.5.min.js"></script>
<script>
$(function(){
//以下为选中值为3的选项,设置完毕后需要刷新
$('#select-native-1').val(3).selectmenu('refresh', true);
})
</script>
</head>
<body>
<div class="ui-field-contain">
<label for="select-native-1">Basic:</label>
<select name="select-native-1" id="select-native-1">
<option value="1">The 1st Option</option>
<option value="2">The 2nd Option</option>
<option value="3">The 3rd Option</option>
<option value="4">The 4th Option</option>
</select>
</div>
</body>
</html>