62,025
社区成员
发帖
与我相关
我的任务
分享
//通过text绑定下拉默认值
SetSelectByText:function (selectid,str)
{
var count = $("#" + selectid + " option").length;
for (var i = 0; i < count; i++) {
if ($("#" + selectid ).get(0).options[i].text == str) {
$("#" + selectid).get(0).options[i].selected = true;
break;
}
}
},
//通过value绑定下拉默认值
SetSelectByValue:function (selectid,str)
{
var count = $("#" + selectid + " option").length;
for (var i = 0; i < count; i++) {
if ($("#" + selectid).get(0).options[i].value == str) {
$("#" + selectid).get(0).options[i].selected = true;
break;
}
}
},
//清空select (设置第一个为默认值);
ClearSelect:function (selectid)
{
try
{
$("#" + selectid).get(0).options[0].selected = true;
}
catch(e)
{
//alert(e.name +"___"+e.message);
}
},