搜索
您的当前位置:首页正文

js获取select下拉框的值

来源:步旅网
获取select选中的值:

var typeNum = $("#type").val();
var typeNum = $("#type").find(“option:selected”).val();
这两个都可以获取到被选中的option的value值。

获取select选中的text

var typeText = $("#type").find(“option:selected”).text();

获取选中select的索引

var typeIndex = $("#type ").get(0).selectedIndex;

设置select的value值

$("#type").val(“11”);

因篇幅问题不能全部显示,请点此查看更多更全内容

Top