jquery radio 取值 取消选中 赋值
<!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 取值 取消选中 赋值的更多相关文章
- jquery radio取值,checkbox取值,select取值及选中
jquery radio取值,checkbox取值,select取值,radio选中,checkbox选中,select选中,及其相关 获取一组radio被选中项的值 var item = $('in ...
- jquery radio取值,checkbox取值,select取值,radio选中,checkbox选中,select选中
jQuery获取Select选择的Text和Value: 语法解释: 1. $("#select_id").change(function(){//code...}); //为Se ...
- jQuery radio取值,checkbox取值,select取值
语法解释: $("#select_id").change(function(){//code...}); //为Select添加事件,当选择其中一项时触发 var checkTex ...
- 2016 系统设计第一期 (档案一)jQuery radio 取值赋值
MVC代码: <div class="form-group"> <label for="Gender" class="col-sm- ...
- easyui 》 radio取值,checkbox取值,select取值,radio选中,checkbox选中,select选中
获取一组radio被选中项的值var item = $('input[@name=items][@checked]').val();获取select被选中项的文本var item = $(" ...
- jquery select取值,赋值操作
select">jquery select取值,赋值操作 一.获取Select 获取select 选中的 text : $("#ddlRegType").find( ...
- 能取值亦能赋值的Python切片
切片,就像面包,给几刀,切成一片一片,可以做成吐司,也可以做成三明治,口味更佳: 列表(list).元组(tuple).字符串(str)都能进行切片,得到子片段,实际上切片操作比想象的要强大很多,能取 ...
- Jquery常用radio取值,checkbox取值,select取值,radio选中,checkbox选中,select选中,及其相关设置
获取一组radio被选中项的值:var item = $('input[name=items][checked]').val(); 获取select被选中项的文本:var item = $(" ...
- jsp之radio取值与赋值
转自:https://blog.csdn.net/dongfengkuayue/article/details/50352937 取radio的值: js代码 $("input[name=' ...
随机推荐
- How Big Is A Petabyte, Exabyte, Zettabyte, Or A Yottabyte?
一个关于Byte递增的描述,蛮有趣的! Bytes -> Kilobyte -> Megabyte -> Gigabyte -> Terabyte -> Petabyte ...
- Stacked injection--堆叠注入--堆查询注入
Stacked injection--堆叠注入--堆查询注入 原文地址;http://www.sqlinjection.net/stacked-queries/ 本篇属于集合原作者的思路和个人想法 ...
- rdtsc获取时间统计程序的运行效率
__u64 rdtsc() { __u32 lo,hi; __asm__ __volatile__ ( "rdtsc&q ...
- close和shutdown的区别
转的,没验证 close(sock_fd)会把sock_fd的内部计数器减1当sock_fd的内部计数器为0时, 才调用shutodwn(), 并最终释放文件描述符调用shutdown()只是进行了T ...
- POJ 1787 Charlie's Change (完全背包/多重背包,输出方案的物品个数)
网上说是多重背包,因为要输出方案,还要记录下路径,百度一下题解就可以. 自己做的时候,还没了解过多重背包,该题直接往完全背包思考了.咖啡的钱看作总的背包容量,1.5.10.25分别代表四种物品的重量, ...
- 在WCF中使用消息队列
在一些大型的解决方案中,假设我们的服务没有办法一直在线,或者因为这样那样的原因宕机了,有没有什么办法让客户端的影响最小化呢?答案是可以通过消息队列的方式,哪怕服务是没有在线的,客户端依然可以继续操作. ...
- UVA 11181 dfs 概率
N friends go to the local super market together. The probability of their buying something from them ...
- dom对象详解--document对象(一)
document对象 Document对象代表整个html文档,可用来访问页面中的所有元素,是最复杂的一个dom对象,可以说是学习好dom编程的关键所在. Document对象是window对象的一 ...
- sql server 2008 评估期已过期解决办法
开始-->所有程序-->Microsoft SQL Server 2008-->配置工具-->SQL Server 安装中心-->维护-->版本升级,接着按照提示一 ...
- asp.net中Literal与label的区别
Literal 控件表示用于向页面添加内容的几个选项之一.对于静态内容,无需使用容器,可以将标记作为 HTML 直接添加到页面中.但是,如果要动态添加内容,则必须将内容添加到容器中.典型的容器有 La ...