zepto 获取select选中的值

jQuery中典型的方法:javascript

$('option[selected]')

无论用,由于selected并非CSS标准。
 
所以,在zepto中想要获取select元素中选中的option,需采起以下方法:
// get OPTION elements for which `selected` property is true
$('option').not(function(){ return !this.selected })

或者推荐java

 $("#ID").val() //获取选中的value   git

$("#ID option").eq($("#ID").attr("selectedIndex")).text() //获取选中的文本值  github

参考资料:https://github.com/madrobby/zepto/issues/503this

相关文章
相关标签/搜索