1.获取select 选中的 text:
$("#cusChildTypeId").find("option:selected").text();
$("#cusChildTypeId option:selected").text()
2.获取select选中的 value:
$("#ddlRegType ").val();
3.获取select选中的索引:
       $("#ddlRegType ").get(0).selectedIndex;
4.得到select项的个数    
$("#cusChildTypeId").get(0).options.length
5.设置select 选中的索引:
      $("#cusChildTypeId").get(0).selectedIndex=index;//index为索引值
6.设置select 选中的value:
     $("#cusChildTypeId").attr("value","Normal");
     $("#cusChildTypeId").val("Normal");
     $("#cusChildTypeId").get(0).value = "Normal";
7.设置select 选中的text:
1>.var count=$("#cusChildTypeId").get(0).options.length;
      for(var i=0;i<count;i++)  
          {            
if($("#cusChildTypeId").get(0).options.text == text)  
          {  
              $("#cusChildTypeId").get(0).options.selected = true;
              break;  
          }  
         }

2>.$("#cusChildTypeId").val(text);
     $("#cusChildTypeId").change();
8.向select中添加一项,显示内容为text,值为value    
$("#cusChildTypeId").get(0).options.add(new Option(text,value));
9.删除select中值为value的项 
         var count = $("#cusChildTypeId").size();            
         for(var i=0;i<count;i++)    
         {    
             if($("#cusChildTypeId").get(0).options[i].value == value)    
             {    
                 $("#cusChildTypeId").get(0).remove(i);    
                 break;    
             }
         }
10.清空 Select:
1>. $("#cusChildTypeId").empty();
2>. $("#cusChildTypeId").get(0).options.length = 0;

jquery 获取和设置Select选项常用方法总结的更多相关文章

  1. JQuery获取和设置Select选项常用方法总结 (转)

    1.获取select 选中的 text: $("#cusChildTypeId").find("option:selected").text(); $(&quo ...

  2. JQuery获取和设置Select选项常用方法总结

    1.获取select 选中的 text: $("#cusChildTypeId").find("option:selected").text(); $(&quo ...

  3. JQuery获取和设置Select选项的常用方法总结

    1.获取select 选中的 text:  $("#cusChildTypeId").find("option:selected").text();  $(&q ...

  4. jquery 获取和设置 select下拉框的值(转手册)

    ##实例应用中遇到的问题 //在某事件响应的应用中设置select选中项,前两种情况的设置不生效,使用了最后一种用法才生效的 //$("#select_time").find(&q ...

  5. jquery 获取和设置 select下拉框的值

    获取Select : 获取select 选中的 text : $("#ddlRegType").find("option:selected").text(); ...

  6. JQuery获取和设置select下拉框的值

    获取Select : 获取select 选中的 text : $("#sid").find("option:selected").text(); 获取selec ...

  7. JQuery获取与设置select

    获取select : 1.获取select 选中的 text :    $("#ddlregtype").find("option:selected").tex ...

  8. jquery获取和设置元素高度宽度

    jquery获取和设置元素高度宽度 1.height()/ width() 取得第一个匹配元素当前计算的高度/宽度值(px) height(val)/ width(val) 为每个匹配的元素设置CSS ...

  9. JQuery获取与设置HTML元素的值value

    JQuery获取与设置HTML元素的值value 作者:简明现代魔法图书馆 发布时间:2011-07-07 10:16:13 20481 次阅读 服务器君一共花费了13.221 ms进行了6次数据库查 ...

随机推荐

  1. spring 使用 maven profile

    先看看 maven 定义 profile 的写法 <!-- profiles --> <profiles> <profile> <activation> ...

  2. C#中委托如何使用?(转帖)

    1.委托概述委托是C#中新加入的一个类型,可以把它想作一个和Class类似的一种类型,和使用类相似,使用一个委托时,需要两个步骤,首先你要定义一个委托,就像是定义一个类一样:然后,你可以创建一个或多个 ...

  3. java编码-多重(乱码)

    一.1,UTF编码 - 2,ISO解码 - 3,UTF编码 - 4,ISO解码 String ISO = "ISO-8859-1"; String UTF = "UTF- ...

  4. linux 信号处理 三 (信号集的使用)

    sigprocmask系统调用 使用条件: 1.有时候不希望在接到信号时就立即停止当前执行,去处理信号,同时也不希望忽略该信号,而是延时一段时间去调用信号处理函数.这种情况是通过阻塞信号实现的. 2. ...

  5. 1110 Complete Binary Tree (25 分)

    1110 Complete Binary Tree (25 分) Given a tree, you are supposed to tell if it is a complete binary t ...

  6. 1038 Recover the Smallest Number (30 分)

    1038 Recover the Smallest Number (30 分) Given a collection of number segments, you are supposed to r ...

  7. 3种方法轻松处理php开发中emoji表情的问题

    背景 做微信开发的时候就会发现,存储微信昵称必不可少. 可这万恶的微信支持emoji表情做昵称,这就有点蛋疼了 一般Mysql表设计时,都是用UTF8字符集的.把带有emoji的昵称字段往里面inse ...

  8. Java常用的加密解密类(对称加密类)

    Java常用的加密解密类 原文转载至:http://blog.csdn.net/wyc_cs/article/details/8793198 原创 2013年04月12日 14:33:35 1704 ...

  9. mongodb 如何区分大小写

    mongodb是区分大小写的,在做mongodb数据库操作是经常使用toUpperCase()等方法将value转换为大写存到数据库中 e.g. 在做数据库模糊查询时语句如下 db.COLLECTIO ...

  10. Python模块之shelve

    shelve是python的自带model. 可以直接通过import shelve来引用. shelve类似于一个存储持久化对象的持久化字典,即字典文件. 使用方法也类似于字典. 保存对象至shel ...