1.获取选中值:$("select[@id='selectid'] option[@selected]").val();//-----selectid是<select>的id
2.设置选中项:$("select[@id='selectid']")[0].selectedIndex = 1;//-----<select>的index从0开始,所以1是第二项
2.设置选中项:$("select[@id='selectid']")[0].selectedIndex = 1;//-----<select>的index从0开始,所以1是第二项
3.赋值:
- 方法一:
- $("<option value='101'>101</option>").appendTo("select[@id='selectid']");
方法二: - var opt=new Option(meg[i],meg[i]);
- $("#selectid").options.add(opt);
方法三: - $("#selectid").append("<option>"+meg[i]+"</option>");