根据文本绑定text

var locationCity = productViewObj.Product.LocationCity; 
var countCity = $("#slCity option").length; 

for (var i = 0; i < countCity; i++) { 
if ($("#slCity").get(0).options[i].text == locationCity) { 
$("#slCity").get(0).options[i].selected = true; 
break; 
} 
}

根据值绑定value

var deliveryTemplateID = productViewObj.Product.DeliveryTemplateID; 
var deliveryCount = $("#deliverySelect option").length; 
for (var i = 0; i < deliveryCount; i++) { 
if ($("#deliverySelect").get(0).options[i].value == deliveryTemplateID) { 
$("#deliverySelect").get(0).options[i].selected = true; 
break; 
} 
}

标签:
下拉框,select,绑定

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
狼山资源网 Copyright www.pvsay.com

评论“下拉框select的绑定示例”

暂无“下拉框select的绑定示例”评论...