【zepto获取select元素的选中option】zepto获取select元素的选中option例子

更新时间:2019-09-26    来源:网页配色    手机版     字体:

【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

本文来源:http://www.bbyears.com/wangyezhizuo/69547.html

猜你感兴趣