Jquery获取selelct选中值
误区:
一直以为jquery获取select中option被选中的文本值,是这样写的:
$("#s").text(); //获取所有option的文本值
实际上应该这样:
$("#s option:selected").text(); //获取选中的option的文本值
获取select中option的被选中的value值,
$("#s").val();
$("#s option:selected").val();
js获取select选中的值:
var sel=document.getElementById("select1");
var index = sel.selectedIndex; // 选中索引
albumid= sel.options[index].value;//要的值
呵呵,这么久了,才发现,以后可得认认真真的了~~~
Jquery获取selelct选中值的更多相关文章
- jquery获取radio选中值及遍历
使用jquery获取radio的值,最重要的是掌握jquery选择器的使用,在一个表单中我们通常是要获取被选中的那个radio项的值,所以要加checked来筛选,比如有以下的一些radio项:1.& ...
- JQuery获取select选中值和清除选中状态(转)
1.获取值 var provinceSearch = $("#loc_province_search").find("option:selected").att ...
- Jquery 获取 radio选中值,select选中值
随着Jquery的作用越来越大,使用的朋友也越来越多.在Web中,由于CheckBox.Radiobutton .DropDownList等控件使用的频率比较高,就关系到这些控件在Jquery中的操作 ...
- 通过Jquery获取RadioButtonList选中值
推荐 使用第二种,第一种有时候不起作用 第一种:通过find方法 获取RadioButtonList所选中的值 <script type="text/javascript"& ...
- 纠正jQuery获取radio选中值的写法
先看一段代码 <input type="radio" name="aaa" value="1" checked="true& ...
- Jquery 获取radio选中值
- jquery 获取checkbox 选中值并拼接字符集
1.代码示例: var chk_value =[]; $('input[name="rewardids"]:checked').each(function(){ chk_val ...
- JQuery 判断checkbox是否选中,checkbox全选,获取checkbox选中值
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- jquery动态选中radio,获取radio选中值
//动态选中radio值,1:表示radio的name 2:表示后台传过来的radio值$(":radio[name='1'][value='" + 2 + "']&qu ...
随机推荐
- UCOS时钟与中断:
OSTimeDly() OSTimeDlyHMSM()上面的函数除了延时功能,主要是会进入任务调度. OSTimeDlyHResume()当某条件达到之后需要停止周期性延时调用该函数. 当调用延时函数 ...
- Restful风格的简单实现办法
如果实在着急上Restful的URL在项目里 , 可以使用turkey的urlrewrite. 先在web.xml中加入如下代码 <!-- URL ReWrite --> <filt ...
- 高可用集群heartbeat全攻略
heartbeat的概念 Linux-HA的全称是High-Availability Linux,它是一个开源项目,这个开源项目的目标是:通过社区开发者的共同努力,提供一个增强linux可靠性(r ...
- 在dom4j中使用XPath
package com.wzh.test.xpath; import java.io.File; import org.dom4j.Document; import org.dom4j.Documen ...
- R %operator% 含义
%foo% is the syntax for a binary operator. In base R: %in%: '"%in%" <- function(x, tabl ...
- sublimetext3 安装php语法检测
打开控制台,install package 搜 sublimelinter 先安装sublimelinter本体 安装完以后再搜索一下,安装sublimelinter-php 接下来,打开prefer ...
- [Flex] as3xls读取excel,修改保存单表(一)
经过大神修改过的as3xls支持中文,并可以修改保存单一sheet,保存后原有的excel样式均会消失,目前仅能如此. <?xml version="1.0" encodin ...
- 【转】SQL Server 查询表的记录数(3种方法,推荐第一种)
--SQL Server 查询表的记录数 --one: 使用系统表. SELECT object_name (i.id) TableName, rows as RowCnt FROM sysindex ...
- List<IPoint> to IPointCollection to IPolygon
IPointCollection 到 IPolygon的转换 IPoint pPoint = new PointClass(); //IPolygon pPolygon1 = n ...
- OC基础(24)
NSMutableArray基本概念 NSDictionary基本概念 NSMutableDictionary基本概念 常见的结构体 *:first-child { margin-top: 0 !im ...