获取Select :
获取select 选中的 text:

1
$("#select_id”).find("option:selected”).text();

获取select选中的 value:

1
2
$("#select_id option:selected”).val();
($("#select_id”).val();这个方法是错误的)

获取select选中的索引:

1
$("#select_id ").get(0).selectedIndex;

设置select:
设置select 选中的索引:

1
$("#select_id ").get(0).selectedIndex=index;//index为索引值

设置select 选中的value:

1
2
3
$("#select_id ").attr("value”,”Normal");
$("#select_id ").val("Normal”);
$("#select_id ").get(0).value = value;

设置select 选中的text:

1
2
3
4
5
6
7
8
9
var count=$("#select_id ").find("option”).length;
for(var i=0;i<count;i++)
{
if($("#select_id ").get(0).options[i].text == text)
{
$("#select_id ").get(0).options[i].selected = true;
break;
}
}

select根据value默认选中

1
$("#SelectID option[value='selectValue']").attr("selected”,true)

清空 Select:

1
2
3
$("#select_id ").empty();
$("#veg1″).find("option”).clone().appendTo("#veg2″); 添加另一个select option
$("#veg2″).get(0).selectedIndex=2; 设置选中项