Zepto和jQuery获取select元素的选中值的文本

jQuery和 Zepto两者获取select的方法有所不同,记录如下:

jQuery

$('#testSelect option:selected').text();//选中的文本

$('#testSelect option:selected') .val();//选中的值

$("#testSelect ").get(0).selectedIndex;//索引

Zepto

$("select[name=provience] option").not(function(){ return !this.selected }).text();

猜你喜欢

转载自tonychow.iteye.com/blog/2298751