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. PHP流程控制的替代语法

    准备做个wordpress的主题,结果看到了如下的语法: <div id="primary" class="content-area"><ma ...

  2. struts2+hibernate+spring+jquery返回json List列表

    1.引入包:struts2-json-plugin-2.1.8.1.jar json-lib-2.1.jar commons-collections-3.2.1.jar commons-beanuti ...

  3. 套题T8&T9

    A - 8球胜负(eight) Time Limit:1000MS     Memory Limit:65535KB     64bit IO Format:%lld & %llu Submi ...

  4. python 解析 xml

    <taskList nextId="62292"> <task module="reliability" owner="vprovo ...

  5. tomcat version

    Tomcat version 6.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 Web modules   转自:http://jingwang0 ...

  6. PCL—低层次视觉—点云分割(RanSaC)

    点云分割 点云分割可谓点云处理的精髓,也是三维图像相对二维图像最大优势的体现.不过多插一句,自Niloy J Mitra教授的Global contrast based salient region ...

  7. HDU 4358 Boring counting 树状数组+思路

    研究了整整一天orz……直接上官方题解神思路 #include <cstdio> #include <cstring> #include <cstdlib> #in ...

  8. ios高版本SDK在低版本真机调试

    将build settings的ios deployment target改为对应真机系统版本即可

  9. WC约束示使用

    1.接口中添加时要注意Xml序列化标签不要随意添加啊.[webInvoke].[OpertorContract]这2个约束就行了.不然,直接坑死啊.

  10. Androidz之Activity概要学习

    Androidz之Activity概要学习 1.     Activity类概述 Activity(活动)是一个单独的.能获取焦点的,且能与用户交互的东西.所以我们通常在Activity类中的onCr ...