1.有时候下拉框的值如果是定下来的(往往会有一个空白项)。默认不是空白项的方法为:

var a = document.getElementById("Id");//Id是select 的Id
a.options[1].selected = true;
//或者
$("#mySelect option:first").prop("selected", 'selected');
//或者
 jquery1.6以下版本
$('select').attr('selectedIndex', 1);
 jquery1.6或以上版本
$('select').prop('selectedIndex', 1);
//或者
var SelectArr = $("select")
for (var i = 0; i < SelectArr.length; i++) {
      SelectArr[i].options[0].selected = true; 
  }
 

  

2.获取下拉框第一条的值:

$("#select_id option:first").val()

  

  

posted on 2016-11-17 15:09  洋洋知道  阅读(2539)  评论(0编辑  收藏  举报