最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
zepto获取select元素的选中option例子
时间:2015-02-06 编辑:简简单单 来源:一聚教程网
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值方法
var item = document.getElementById("");
var text = item.options[item.selectedIndex].text;
jQuery
var text = $("#selector")[0].options[$("#selector")[0].selectedIndex].text
相关文章
- HTML简单购物数量小程序代码展示 10-31
- html canvas实现弹幕功能 10-31
- HTML中空格表示的意义 10-31
- html area标签解读 10-31
- html使用表单标签实现注册页面代码展示 10-31
- 使用HTML截图并保存为本地图片的代码展示 10-31