jQuery获取Radio选择的Value值

 $("input[name='radio_name'][checked]").val();  //选择被选中Radio的Value值
$("#text_id").focus(function(){//code...}); //事件 当对象text_id获取焦点时触发
$("#text_id").blur(function(){//code...}); //事件 当对象text_id失去焦点时触发
$("#text_id").select(); //使文本框的Vlaue值成选中状态
$("input[name='radio_name'][value='要选中Radio的Value值'").attr("checked",true); //根据Value值设置Radio为选中状态

jQuery获取CheckBox选择的Value值

$("input[name='checkbox_name'][checked]");  //选择被选中CheckBox元素的集合 如果你想得到Value值你需要遍历这个集合
$($("input[name='checkbox_name'][checked]")).each(function(){arrChk+=this.value + ',';});//遍历被选中CheckBox元素的集合 得到Value值
$("#checkbox_id").attr("checked"); //获取一个CheckBox的状态(有没有被选中,返回true/false)
$("#checkbox_id").attr("checked",true); //设置一个CheckBox的状态为选中(checked=true)
$("#checkbox_id").attr("checked",false); //设置一个CheckBox的状态为不选中(checked=false)
$("input[name='checkbox_name']").attr
("checked",$("#checkbox_id").attr("checked"));//根据3,4,5条,你可以分析分析这句代码的意思
$("#text_id").val().split(","); //将Text的Value值以','分隔 返回一个数组

jQuery-对Radio/CheckBox的操作集合的更多相关文章

  1. 使用jQuery获取radio/checkbox组的值的代码收集

    <!-- $("document").ready(function(){ $("#btn1").click(function(){ $("[na ...

  2. Radio Checkbox Select 操作

    一个小总结 <!DOCTYPE html> <html> <head> <meta name="description" content= ...

  3. jquery mobile radio,checkbox button 样式设置

    <label><input type=checkbox ></label>,<input type=checkbox id="checkbox &q ...

  4. :radio :checkbox

    匹配所有单选按钮   示例 描述: 查找所有单选按钮 HTML 代码: <form> <input type="text" /> <input typ ...

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

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

  6. [转]jQuery操作radio、checkbox、select 集合.

    1.radio:单选框 html代码 <input type="radio" name="radio" id="radio1" val ...

  7. jQuery操作radio、checkbox、select 集合

    1.radio:单选框 HTML代码: <input type="radio" name="radio" id="radio1" va ...

  8. jquery对radio和checkbox的操作

    jQuery获取Radio选择的Value值 代码  $("input[name='radio_name'][checked]").val(); //选择被选中Radio的Valu ...

  9. jQuery获取Radio选择的Value值||两个select之间option的互相添加操作(jquery实现)

    jQuery获取Radio选择的Value值: 1. $("input[name='radio_name'][checked]").val();  //选择被选中Radio的Val ...

随机推荐

  1. 01-08-03【Nhibernate (版本3.3.1.4000) 出入江湖】二级缓存:NHibernate自带的HashtableProvider之缓存管理

    http://www.cnblogs.com/lyj/archive/2008/11/28/1343418.html 管理NHibernate二级缓存 NHibernate二级缓存由ISessionF ...

  2. 自定义nagios check_load告警阀值

    自定义nagios  check_load告警阀值 日期:2012-01-11 来源: heipark 分享至: - 默认check_load配置 define service{ use generi ...

  3. POJ 1731

    #include<iostream> #include<string> #include<algorithm> using namespace std; int m ...

  4. Javascrip操作json方法

    var str1 = '{ "name": "cxh", "sex": "man" }'; var data=eval( ...

  5. Ubuntu环境下手动配置ant

    配置ant 1. 下载ant(http://ant.apache.org/bindownload.cgi) 例如我下载的是:apache-ant-1.9.4-bin.tar.gz 解压ant,将文件夹 ...

  6. NET权限系统开源项目

    http://www.cnblogs.com/yubaolee/p/OpenAuth.html http://www.cnblogs.com/guozili/p/3496265.html Sereni ...

  7. C#中dynamic的正确用法 以及 typeof(DynamicSample).GetMethod("Add");

    dynamic是FrameWork4.0的新特性.dynamic的出现让C#具有了弱语言类型的特性.编译器在编译的时候不再对类型进行检查,编译期默认dynamic对象支持你想要的任何特性.比如,即使你 ...

  8. JS创建对象

    本人常用的创建对象的方式,仅供参考,欢迎吐槽,谢谢! 创建对象1.对象字面量,即使用大括号,如下: (function(){ var obj = { id: 1, desc: '创建对象测试开始啦!' ...

  9. [图解教程]Eclipse不可不知的用法之一:自动生成Getter、Setter和构造方法

    [图解教程]Eclipse不可不知的用法之一:自动生成Getter.Setter和构造方法 关键词:Getters and Setters.getter和setter方法.Constructor us ...

  10. 猜拳 GuessFist

    import java.util.Scanner;import java.util.Random;/***跟电脑玩石头剪刀布,需要从控制台输入信息,*然后去判断,然后给予反馈信息*/public cl ...