废话不多说直接上代码:
HTML:
<div data-role="fieldcontain">
                      <fieldset data-role="controlgroup" data-type="horizontal" data-mini="true">
    <legend>请选择所在省市</legend>
    <label for="province">请选择省份</label>
    <select name="province" id="province" onchange="findCity(this);">
        <option value="">请选择省份</option>
    </select>
    <label for="city">请选择城市</label>
    <select name="city" id="city">
        <option value="">请选择城市</option>
    </select>
</fieldset>
                    </div>
js
//页面加载时,查询出所有省份
$.ajax({
type:"post",
url:"<%=request.getContextPath() %>/mpcustom/findprovince.mobile",
success:function(html){
var select = $("#province");
var allProArr = html.split(";");
for ( var i = 0; i < allProArr.length; i++) {
var siglePro = allProArr[i].split(",");
$("<option value='"+siglePro[0]+"'>" + siglePro[1] + "</option>").appendTo(select);
}
}
});
  //页面加载时,若是已注册用户,则选好省市
  var provId = "${custom.province}";
  var cityId = "${custom.city}";
  var select_pro = $("#province");
  var select_city = $("#city");
                                   //alert(provId) ;
  select_pro.val(provId);
  select_pro.selectmenu("refresh",true);
  select_city.val(cityId);
  select_city.selectmenu("refresh");
省市都赋值不上。去掉alert的注释,在火狐上则能显示出省。还请大神出马!!!jquerymobile