- 博客(0)
- 资源 (2)
空空如也
js select类
//得到select项的个数
jQuery.fn.size = function(){
return $(this).get(0).options.length;
}
//获得选中项的索引
jQuery.fn.getSelectedIndex = function(){
return $(this).get(0).selectedIndex;
}
//获得当前选中项的文本
jQuery.fn.getSelectedText = function(){
if(this.size() == 0) return "下拉框中无选项";
else{
var index = this.getSelectedIndex();
return $(this).get(0).options[index].text;
}
}
2011-05-12
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人