1. $("#select_id").change(function(){... });   //为select添加事件,当选择其中一项时触发
2. $("#select_id").find("option:selected").text();  //获取select选中的Text
3. $("#select_id").val();  //获取Select选中的Value
4. $("#select_id ").get(0).selectedIndex;  //获取Select选中的索引值
5. $("#select_id option:last").attr("index");  //获取Select最大的索引值

6.$("#select_id ").get(0).selectedIndex=1;  //设置Select索引值为1的项选中
7. $("#select_id ").val(4);   //设置Select的Value值为4的项选中
8. $("#select_id option[text='jQuery']").attr("selected", true);   //设置Select的Text值为jQuery的项选中

$("#tradeType option[value='1']").attr("selected", true); //设置select的value值为1时被选中

9.$("#select_id").append("<option value='Value'>Text</option>");  //为Select追加一个Option(下拉项)
10. $("#select_id").prepend("<option value='0'>请选择</option>");  //为Select插入一个Option(第一个位置)
11. $("#select_id option:last").remove();  //删除Select中索引值最大Option(最后一个)
12. $("#select_id option[index='0']").remove();  //删除Select中索引值为0的Option(第一个)
13. $("#select_id option[value='3']").remove();  //删除Select中Value='3'的Option
14. $("#select_id option[text='4']").remove();  //删除Select中Text='4'的Option

15.遍历select

$("#typeId option").each(function(){
        if($(this).text()=="游戏娱乐"){
           $(this).attr("selected", true);
        }

});

jQuery Select的操作集合的更多相关文章

  1. jQuery select的操作代码

    jQuery對select的操作的实际应用代码. //改變時的事件  复制代码代码如下: $("#testSelect").change(function(){ //事件發生  j ...

  2. jQuery select的操作实现代码

          //改变时的事件  $("#testSelect").change(function(){ //事件发生生 jQuery('option:selected', this ...

  3. jquery select 常用操作总结

    由于在项目各种所需,经常碰到select不种操作的要求,今天特意总结了一下,分享: jQuery获取Select选择的Text和Value: 语法解释: 1. $("#select_id&q ...

  4. jquery的radio和checkbox的标签的操作集合

    jquery的radio和checkbox的标签的操作集合: $("input[name='radio_name'][checked]").val(); //选择被选中Radio的 ...

  5. jquery select取值,赋值操作

    select">jquery select取值,赋值操作 一.获取Select 获取select 选中的 text : $("#ddlRegType").find( ...

  6. js jquery select 操作 获取值,选中选项,增加,修改,删除

    select示例: <select id="sel"> <option value="1">one</option> < ...

  7. 【jq】JQuery对select的操作

    下拉框 <select id="selectID" name="selectName"> <option vlaue="1" ...

  8. 【jQuery基础学习】02 jQuery的DOM操作

    DOM操作分为3个方面: DOM Core    任何一种支持DOM Core的语言都可以使用它,比如getElementById就是DOM Core操作 HTML-DOM  只能用来处理web文档 ...

  9. 前端 ----jQuery的属性操作

    04-jQuery的属性操作   jquery的属性操作模块分为四个部分:html属性操作,dom属性操作,类样式操作和值操作 html属性操作:是对html文档中的属性进行读取,设置和移除操作.比如 ...

随机推荐

  1. python中str()和repr()的区别

    >>> s = 'Hello, world.' >>> str(s) 'Hello, world.' >>> repr(s) "'Hel ...

  2. 2014 Super Training #10 D 花生的序列 --DP

    原题: FZU 2170 http://acm.fzu.edu.cn/problem.php?pid=2170 这题确实是当时没读懂题目,连样例都没想通,所以没做了,所以还是感觉这样散漫的做不好,有些 ...

  3. ES5和ES6中对于继承的实现方法

    在ES5继承的实现非常有趣的,由于没有传统面向对象类的概念,Javascript利用原型链的特性来实现继承,这其中有很多的属性指向和需要注意的地方. 原型链的特点和实现已经在之前的一篇整理说过了,就是 ...

  4. [转]比较Jmeter、Grinder和JAVA多线程本身压力测试所带来的性能开销

    1. 测试环境 jmeter版本 :jmeter 2.4 grinder的版本 : Grinder 3 JAVA的版本:JDK 1.6 2. 测试代码 Jmeter测试代码 public class  ...

  5. 转: Github访问慢解决办法

    from: https://yq.aliyun.com/articles/36744 Github访问慢解决办法   zxiaofan 2016-04-20 17:25:00 浏览2156 评论0 摘 ...

  6. iOS app上传错误集锦(转载)

    1.工程里增加了版本自动更新. 2.未增加判断网络状态的类Reachability. 3.问题:error itms -90049 This bundel is invalid. The bundle ...

  7. Linux ncurses编写 FlapyBird 第一步

    /* * flapybird.h * * Created on: 2016年9月15日 * Author: jon */ #include <curses.h> #include < ...

  8. Spring中使用Quartz

    package com.ncs.hj; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; ...

  9. 18Spring_AOP编程(AspectJ)_AspectJ的各种通知总结

    小结: 前置通知(权限控制). 后置通知 ---- 不怎么用 环绕通知(权限控制. 性能监控. 缓存技术 ) 异常通知 (发生异常后, 记录错误日志 ) 最终通知 (释放资源 ) 环绕通知 是取代任何 ...

  10. JS框架之收集专帖

    1.KNOCKOUT.JS 官网:http://knockoutjs.com/ 学习:http://www.cnblogs.com/TomXu/archive/2011/11/21/2257154.h ...