【www.bbyears.com--网页配色】
zepto
在zepto中不能用,网上搜索了一番,找到了一个方法:
$(‘option’).not(function(){ return !this.selected });
这样就可以在zepto中获取到select中被选中的option。
补充知识点:
问题:$("option[selected]") only finds options that have their selected attr set in the html.It does not find values the the user has selected themselves.
jquery与js获得option值方法
javascript
var item = document.getElementById("");
var text = item.options[item.selectedIndex].text;
jQuery
var text = $("#selector")[0].options[$("#selector")[0].selectedIndex].text