1.获取选中值,三种方法都可以:

  1. $('input:radio:checked').val();
  2. $("input[type='radio']:checked").val();
  3. $("input[name='rd']:checked").val();

2、设置第一个Radio为选中值:

  1. $('input:radio:first').attr('checked', 'checked');
  2. 或者
  3. $('input:radio:first').attr('checked', 'true');
  4. 注: attr("checked",'checked')= attr("checked", 'true')= attr("checked", true)

3.设置最后一个Radio为选中值:

  1. $('input:radio:last').attr('checked', 'checked');
  2. 或者
  3. $('input:radio:last').attr('checked', 'true');

4.根据索引值设置任意一个radio为选中值:

  1. $('input:radio').eq(索引值).attr('checked', 'true');索引值=0,1,2....
  2. 或者
  3. $('input:radio').slice(1,2).attr('checked', 'true');

5.根据Value值设置Radio为选中值

  1. $("input:radio[value='rd2']").attr('checked','true');
  2. 或者
  3. $("input[value='rd2']").attr('checked','true');

6.删除Value值为rd2的Radio

  1. $("input:radio[value='rd2']").remove();

7.删除第几个Radio

  1. $("input:radio").eq(索引值).remove();索引值=0,1,2....
  2. 如删除第3个Radio:$("input:radio").eq(2).remove();

8.遍历Radio

  1. $('input:radio').each(function(index,domEle){
  2. //写入代码
  3. });

Jquery操作单选按钮(Radio)的取值赋值实现代码的更多相关文章

  1. Jquery操作下拉框(DropDownList)的取值赋值实现代码(王欢)

    Jquery操作下拉框(DropDownList)的取值赋值实现代码(王欢) 1. 获取选中项: 获取选中项的Value值: $('select#sel option:selected').val() ...

  2. 单选按钮(radio)的取值和点击事件

    笔记走一波:获取单选按钮(radio)的选中值,以及它的点击事件的实现 首先要引入Jquery <script type="text/javascript" src=&quo ...

  3. Jquery 关于span标签的取值赋值用法

    span是最简单的容器,可以当作一个形式标签,其取值赋值方法有别于一般的页面元素. //赋值 $("#spanid").html(value) //取值 $("#span ...

  4. JQuery关于span标签的取值赋值

    span取值赋值方法有别于一般的页面元素.JQ://赋值$("#spanid").html("hello world") //取值$("#spanid ...

  5. Jquery操作复选框(CheckBox)的取值赋值实现代码

    赋值 复选框 CheckBox 遍历 取值  1. 获取单个checkbox选中项(三种写法): $("input:checkbox:checked").val() 或者 $(&q ...

  6. jquery操作select(选中,取值)

    最近工作中总出现select 和 option问题,整理一下,内容大部分源于网络资料 一.基础取值问题 例如<select class="selector"></ ...

  7. Jquery中的CheckBox、RadioButton、DropDownList的取值赋值实现代码

    随着Jquery的作用越来越大,使用的朋友也越来越多.在Web中,由于CheckBox. Radiobutton . DropDownList等控件使用的频率比较高,就关系到这些控件在Jquery中的 ...

  8. jQuery操作单选按钮(radio)用法

    1.获取选中值,四种方法都可以: $('input:radio:checked').val():$("input[type='radio']:checked").val(); $( ...

  9. JQuery select与radio的取值与赋值

    radio 取:$("input[name='NAME']:checked").val(); 赋:$("input[name='NAME'][value='指定值']&q ...

随机推荐

  1. nyoj 168 房间安排(区间覆盖)

    房间安排 时间限制:3000 ms  |  内存限制:65535 KB 难度:2   描述 2010年上海世界博览会(Expo2010),是第41届世界博览会.于2010年5月1日至10月31日期间, ...

  2. [置顶] 单机版hadoop实例安装

    目标:运行单机版hadoop http://localhost:50030mapredule监控界面 http://localhost:50070HDFS监控页面 -->安装linux系统 -- ...

  3. 怎么从代码中拿到栈回溯信息(call stack trace)

    博客搬到了fresky.github.io - Dawei XU,请各位看官挪步.最新的一篇是:怎么从代码中拿到栈回溯信息(call stack trace).

  4. [Node.js] Creating JWTs (JSON Web Tokens) in Node

    In this lesson we will look at all of the pieces that combine together to create a JWT (j AWT) or JS ...

  5. iOS开发中一些常用的方法

    1.压缩图片 #pragma mark 处理图片 - (void)useImage:(UIImage *)image { NSLog(@"with-----%f heught-----%f& ...

  6. careercup-递归和动态规划 9.1

    9.1 有个小孩正在上楼梯,楼梯有n阶台阶,小孩一次可以上1阶.2阶或3阶.实现一个方法,计算小孩有多少种上楼梯的方法. 解法: 我们可以采用自上而下的方式来解决这个问题.小孩上楼梯的最后一步,也就是 ...

  7. Free and Open Source Load-Balancing Software and Projects--转

    http://www.inlab.de/articles/free-and-open-source-load-balancing-software-and-projects.html This ove ...

  8. Executing System commands in Java---ref

    One of the nice features of Java language is that it provides you the opportunity to execute native ...

  9. Android5.0之Activity的转场动画

    Activity的转场动画很早就有,但是太过于单调,样式也不好看,于是Google在Android5.0之后,又推出的新的转场动画,效果还是非常炫的,今天我们一起来看一下. 1.旧转场动画回顾 首先我 ...

  10. php笔记07:http响应详解(禁用缓存设置和文件下载)

    演示如何通过Http响应控制页面缓存,在默认情况下,浏览器是会缓存页面的1.禁用缓存设置 (1).我在...\htdocs\http文件夹,写一个cache.php文件如下: <?php ech ...