两种方法获取select下拉框选中的option的值
来源:互联网 发布:foxit reader linux 编辑:程序博客网 时间:2024/05/19 17:09
第一种
<select name="type" id="aaa" onchange="show_sub()"> <option value="0">请选择主菜名</option> <option value="1">白菜</option> <option value="2">萝卜</option> </select>
js代码
function show_sub(){ alert($("#aaa").find("option:selected").attr("value")); }
第二种
<select name="type" onchange="show_sub(this.options[this.options.selectedIndex].value)"> <option value="0">请选择主菜名</option> <option value="1">白菜</option> <option value="2">萝卜</option> </select>
js代码
<script> function show_sub(v){ alert(v); } </script>
两种效果都是一样的
阅读全文
0 0
- 两种方法获取select下拉框选中的option的值
- Javascript获取select下拉框选中的的值,select中指定option选中触发事件
- jquery 获取select下拉框 选中的option ???
- 下拉列表select动态添加option和获取选中的option的值和value
- 获取select下拉框选中的值
- 获取select下拉框的选中值
- js获取select选中option的值
- JQ获取到下拉框内选中的option值
- select获取下拉框的值 下拉框默认选中
- Select下拉框onchange事件获取option的value值
- Select下拉框onchange事件获取option的value值
- Select下拉框onchange事件获取option的value值
- Select下拉框onchange事件获取option的value值
- Select下拉框onchange事件获取option的value值
- Select下拉框onchange事件获取option的value值
- Select下拉框onchange事件获取option的value值
- Select下拉框onchange事件获取option的value值
- jquery select option 选中下拉框的text文本
- Linux的SOCKET编程详解
- 关于DNF的多媒体包NPK文件的那些事儿(1)
- 并发处理业务
- python 安装
- 练习1-8 编写一个统计空格、制表符与换行符个数的程序
- 两种方法获取select下拉框选中的option的值
- 5个数组Array方法: indexOf、filter、forEach、map、reduce使用实例
- Mysql 函数(个人收藏)
- iOS ffmpeg + libfdk-aac
- TabContainer要实现服务器端回传
- 解决问题了
- linux常用命令--uniq
- Effective STL 9 erasing options
- 基础知识