radio取值
假设代码如下:
1) <input type="radio" name="radio" id="radio1" checked="checked" value="radio1">
2) <input type="radio" name="radio" id="radio2" value="radio2">
3) <input type="radio" name="radio" id="radio3" value="radio3">
1.获取选中值,三种方法都可以:
$('input:radio:checked').val();
$("input[type='radio']:checked").val();
$("input[name='rd']:checked").val();
2.设置第一个Radio为选中值:
$('input:radio:first').attr('checked', 'checked');
或者
$('input:radio:first').attr('checked', 'true');
注:attr("checked",'checked')= attr("checked", 'true')
3.设置最后一个Radio为选中值:
$('input:radio:last').attr('checked', 'checked');
或者
$('input:radio:last').attr('checked', 'true');
4.根据索引值设置任意一个radio为选中值:
$('input:radio').eq(索引值).attr('checked', 'true');索引值=0,1,2....
5.根据Value值设置Radio为选中值
$("input:radio[value=radio1']").attr('checked','true');
或者
$("input[value=radio1]").attr('checked','true');
radio取值的更多相关文章
- jQuery radio取值,checkbox取值,select取值
语法解释: $("#select_id").change(function(){//code...}); //为Select添加事件,当选择其中一项时触发 var checkTex ...
- easyui 》 radio取值,checkbox取值,select取值,radio选中,checkbox选中,select选中
获取一组radio被选中项的值var item = $('input[@name=items][@checked]').val();获取select被选中项的文本var item = $(" ...
- 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 ...
- 2016 系统设计第一期 (档案一)jQuery radio 取值赋值
MVC代码: <div class="form-group"> <label for="Gender" class="col-sm- ...
- jsp之radio取值与赋值
转自:https://blog.csdn.net/dongfengkuayue/article/details/50352937 取radio的值: js代码 $("input[name=' ...
- Jquery常用radio取值,checkbox取值,select取值,radio选中,checkbox选中,select选中,及其相关设置
获取一组radio被选中项的值:var item = $('input[name=items][checked]').val(); 获取select被选中项的文本:var item = $(" ...
- jquery radio 取值 取消选中 赋值
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- easyui radio 取值和赋值
1.html文件 <td><input id="client" type="text" name="client" sty ...
随机推荐
- [暴力+前缀和]2019牛客暑期多校训练营(第六场)Upgrading Technology
链接:https://ac.nowcoder.com/acm/contest/886/J来源:牛客网 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 262144K,其他语言52428 ...
- CodeForces 196B Infinite Maze
Infinite Maze time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...
- angular中$q用法, $q多个promise串行/同步/等待), $q.all用法,使用
$q的基本用法 function fn() { var defer = $q.defer(); setTimeout(function () { console.log(1); defer.resol ...
- 【笔记3-27】Python语言基础
流程控制语句 if语句 input() if-else if-elif-else
- spring5之容器始末源码赏析 (一)总览
首先,本系列并不是以介绍spring5 的新特性为主,之所以以spring5为标题,是因为即将赏析的源码来自最新的spring版本.虽说是spring最新版本,但是容器的整个生命周期与之前版本相比,并 ...
- Mac下安装安装selenium与安装chromedriver安装
开发环境:MacOS,Python3.7 1. 安装selenium 可以使用pip安装(pip install selenium)或者使用pycharm进行安装下载 2. 运行如下代码: from ...
- JQuery主要内容
一.什么是JQuery jquery全称javaScript Query,是js的一个框架,本质上仍然是js 二.jQuery的特点 支持各种主流浏览器 使用特别简单 拥有丰富的插件和边界的插件扩展机 ...
- Python函数之面向过程编程
一.解释 面向过程:核心是过程二字,过程即解决问题的步骤,基于面向过程去设计程序就像是在设计,流水线式的编程思想,在设计程序时,需要把整个流程设计出来, 一条工业流水线,是一种机械式的思维方式 二.优 ...
- 在Android Studio中导入jar包
#1 下载jar包文件, #2 拷贝到libs目录下 #3 打开你的build.gradle,在dependencies加入如下代码 dependencies {compile files('libs ...
- docker-compose 部分错误
Get https://hub.17kxkx.com/v2/: dial tcp 39.106.209.67:443: connect: connection refused vim /etc/doc ...