<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script type="text/javascript" src="jquery-1.11.1.min.js"> </script>
<script>
$(function() {
$("#studentBtn").click(function() {
//var student = $("#student").val();//不管选没选中,只取第一个
//var student = $("#student:checked").val();//取选中项
//$("#student:checked").attr("checked",false);//取消选中项
//$("#student:eq(3)").attr("checked",true);//指定选中项(无效)
//$("#student[value=2]").attr("checked",true);//指定选中项(IE8有效,谷歌不可用,qq(IE10内核)不可用,火狐无效)
//$("#student[type=radio]:eq(2)").attr("checked",true);//指定选中项选中
//$("#student[value=2]").attr("checked",true);//指定值的项选中(无效)
//$("input[id=student][value=2]").attr("checked",true);//指定值的项选中
//var studentNo = $("#studentNo").val();
//$("#student:checked").attr("checked",false);
//指定值的项选中(1、IE下可用(IE8内核) 2、谷歌下可用 3、QQ(IE10内核)下只有第一次执行成功,第二次无效 4、火狐下无论多少次无效)
//$("input[type=radio][name=student][value='"+$("#studentNo").val()+"']").attr("checked",true);
//alert(student);
});
})
</script>
</head> <body>
<input name="student" id="student" type="radio" value="0" />张飒
<input name="student" id="student" type="radio" checked="checked" value="1" />李斯
<input name="student" id="student" type="radio" value="2" />王武
<input name="student" id="student" type="radio" value="3" />赵丽 输入学号:
<input type="text" name="studentNo" id="studentNo" value="0" />
<input type="button" name="studentBtn" id="studentBtn" onclick="chooseStudent()" value="确定" />
</body>
</html>

jquery radio 取值 取消选中 赋值的更多相关文章

  1. jquery radio取值,checkbox取值,select取值及选中

    jquery radio取值,checkbox取值,select取值,radio选中,checkbox选中,select选中,及其相关 获取一组radio被选中项的值 var item = $('in ...

  2. jquery radio取值,checkbox取值,select取值,radio选中,checkbox选中,select选中

    jQuery获取Select选择的Text和Value: 语法解释: 1. $("#select_id").change(function(){//code...}); //为Se ...

  3. jQuery radio取值,checkbox取值,select取值

    语法解释: $("#select_id").change(function(){//code...}); //为Select添加事件,当选择其中一项时触发 var checkTex ...

  4. 2016 系统设计第一期 (档案一)jQuery radio 取值赋值

    MVC代码: <div class="form-group"> <label for="Gender" class="col-sm- ...

  5. easyui 》 radio取值,checkbox取值,select取值,radio选中,checkbox选中,select选中

    获取一组radio被选中项的值var item = $('input[@name=items][@checked]').val();获取select被选中项的文本var item = $(" ...

  6. jquery select取值,赋值操作

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

  7. 能取值亦能赋值的Python切片

    切片,就像面包,给几刀,切成一片一片,可以做成吐司,也可以做成三明治,口味更佳: 列表(list).元组(tuple).字符串(str)都能进行切片,得到子片段,实际上切片操作比想象的要强大很多,能取 ...

  8. Jquery常用radio取值,checkbox取值,select取值,radio选中,checkbox选中,select选中,及其相关设置

    获取一组radio被选中项的值:var item = $('input[name=items][checked]').val(); 获取select被选中项的文本:var item = $(" ...

  9. jsp之radio取值与赋值

    转自:https://blog.csdn.net/dongfengkuayue/article/details/50352937 取radio的值: js代码 $("input[name=' ...

随机推荐

  1. IT架构之IT架构模型——思维导图

    参考: [日] 野村综合研究所系统咨询事业本部. 图解CIO工作指南. 周自恒译 人民邮电出版社,2014

  2. CSS 外边距(margin)重叠及防止方法

    边界重叠是指两个或多个盒子(可能相邻也可能嵌套)的相邻边界(其间没有任何非空内容.补白.边框)重合在一起而形成一个单一边界. 两个或多个块级盒子的垂直相邻边界会重合.结果的边界宽度是相邻边界宽度中最大 ...

  3. (转)单机上配置hadoop

    哈哈,几天连续收到百度两次电话,均是利好消息,于是乎不知不觉的自己的工作效率也提高了,几天折腾了好久终于在单机上配置好了hadoop,然后也成功的运行了一个用例,耶耶耶耶耶耶. 转自:http://w ...

  4. jquery ajax post 传递数组 ,多checkbox 取值

    jquery ajax post 传递数组 ,多checkbox 取值 http://w8700569.iteye.com/blog/1954396 使用$.each(function(){});可以 ...

  5. Visual Studio 常用快捷键 (二)

    想不到上一篇 [Visual Studio 常用快捷键] 受这么多人的欢迎.看来大家对Visual Studio的用法非常感兴趣. 接下来我准备写一个 “Visual Studio使用技巧 ” 一个系 ...

  6. 绑定CPU

    处理器的亲和性 软亲和性(affinity) 意味着进程并不会在处理器之间频繁迁移,而 硬亲和性(affinity) 则意味着进程需要在您指定的处理器上运行. 通常 Linux 内核都可以很好地对进程 ...

  7. mq_open

    NAME mq_open - 打开一个消息队列 (REALTIME) SYNOPSIS #include <mqueue.h> mqd_t mq_open(const char *name ...

  8. java jms

    这篇博文我们主要介绍J2EE中的一个重要规范JMS,因为这个规范在企业中的应用十分的广泛,也比较重要,我们主要介绍JMS的基本概念和它的模式,消息的消费以及JMS编程步骤. 基本概念 JMS是java ...

  9. STL:string 大小(Size)和容量(Capacity)

    strings存在三种“大小”: 1.size()和length() 返回string中现在的字符个数.上述两个函数等效. 成员函数empty()用来检验字符数是否为0,亦即字符串是否为空.你应该优先 ...

  10. 在编辑框(CEdit)控件上追加内容

    版权声明:本文为博主原创文章,未经博主允许不得转载. // MFC 版本 CEdit* pEdit = GetDlgItem(IDC_EDIT1); ASSERT(pEdit && p ...