zeptojs中获取select选中的option的值
2015-10-09 11:18
477 查看
第一种方法
// get OPTION elements for which `selected` property is true $('option').not(function(){ return !this.selected })
问题
:$(‘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.
结论:
This is expected behavior. Such CSS selectors match attribute values, which don’t change with user interaction. Theselected property of the element changes, but attribute doesn’t.
第二种方法
$("#ID").val() 获取选中的value $("#ID option").eq($("#ID").attr("selectedIndex")).text() 获取选中的文本值
相关文章推荐
- Lua编程示例(一):select、debug、可变参数、table操作、error
- SQL学习笔记三 select语句的各种形式小结
- 一条select语句引起的瓶颈问题思考
- SQL Select语句完整的执行顺序
- mysql SELECT语句去除某个字段的重复信息
- 点击按钮后 文本框变为Select下拉列表框
- javascript 模拟select下拉列表特效
- javascript select options 排序(保持option 对象完整性)
- 用javascript和css模拟select的脚本
- js select常用操作控制代码
- mysql中insert与select的嵌套使用方法
- jquery的clone方法应用于textarea和select的bug修复
- SQLServer中SELECT语句的执行顺序
- MySQL进阶SELECT语法篇
- asp中 select top 问题!~
- ASP中获得Select Count语句返回值的方法
- 数据库插入数据之select into from与insert into select区别详解
- Javascript select控件操作大全(新增、修改、删除、选中、清空、判断存在等)
- JS option location 页面跳转实现代码
- jQuery实现的仿select功能代码