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=' ...
随机推荐
- Rust: lifetime
Rust的lifetime算是它最重要的特性之一,也不大好理解,特别是官方文档的介绍有些太过简略,容易让人误解. 这篇文章: Rust Lifetimes 应该可以解答很多人疑惑,特别是有关lifet ...
- Java正则表达式匹配例子
Java正则表达式匹配例子 package com.ibm.test; import java.util.regex.Matcher; import java.util.regex.Pattern; ...
- 浏览器执行js
Scriptish chrome自带 greasemonkey http://www.firefox.net.cn/forum/viewtopic.php?f=5&t=45715
- 集合类 Collection
1.Collection接口有两个子接口: List:保存元素顺序的线性表,允许有重复元素. Set:不记录元素的保存顺序,不允许有重复元素.数学中的集合 Collection接口中的方法如下: Co ...
- ZOJ3238 Water Ring(计算几何)
题意:给你一个圆形和很多个矩形,然后要你求圆形的圆周有多少被矩形覆盖. 思路:比赛的时候是有思路的了,不过一直在调别的题,最后剩下30分钟肯定来不及敲.想法是这样的,要是我们可以求出每个矩形覆盖了圆周 ...
- POJ 2101
#include <iostream> #include <algorithm> #include <cmath> using namespace std; int ...
- POJ 1656
#include<iostream>//chengdacaizi 08 .11. 12 #include<string> using namespace std; ][]={} ...
- css系列-段落首字符下沉、缩进及特殊显示
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Codeforces Round #336 (Div. 2) D. Zuma 区间dp
D. Zuma Genos recently installed the game Zuma on his phone. In Zuma there exists a line of n gems ...
- mfc和win32区别
Win32通常是指sdk编程方法,app没有被封装,开发人员需要自己搭程序框架:mfC则是以C++类的形式封装了Windows的API,并且包含一个应用程序框架,以减少应用程序开发人员的工作量 (整理 ...