Jquery中input:type=radio的监听,获取设置值
一、html
<div id='demo'>
<input type='radio' name='sex' value='男' >
<input type='radio' name='sex' value='女' checked='checked'>
</div>
二、获取或设置值
值为女
$('#demo input:radio[name="sex"]:checked').val();
或
$('#demo input[name="sex"]:checked').val();
三、监听
$("#demo :radio").on('click', function () {
//var item=$('input:radio[name="sex"]:checked').val();
//或者
var item= $(this).val();
console.log(item);
})
Jquery中input:type=radio的监听,获取设置值的更多相关文章
- jQuery操作<input type="radio">
input type="radio">如下: <input type="radio" name="city" value=&qu ...
- Jquery给input[type=radio] 控件赋值
setobject: function (data, scope, win) { //data jsoon数据, scope,一般为form的id,win 窗口对象,如果在当前window win=n ...
- 关于Vue中,使用watch同时监听两个值的实现方法
1. 先在computed中,用需要监听的两个值(start.end)定义一个对象(dateRange) computed: { dateRange () { const { start, end } ...
- 工作总结 js 选择器选择多条元素 支持一起设置他们属性 $("#edumes input[type='radio']").prop("checked", false);
$("#edumes input[type='radio']").prop("checked", false); $("#edumes input[t ...
- input type="radio" jquery判断checked的三种方法:
<input type="radio" name="radioname" value="" />全部 <input typ ...
- form中 单选框 input[type="radio"] 分组
在form中有时候需要给单选框分组,这种情况下 可以通过给单选框设置相同的name来进行分组: <html> <head> <title> </title&g ...
- jquery 获取 input type radio checked的元素
.find('input:radio:checked'):.find("input[type='radio']:checked");.find("input[name=' ...
- 自定义input[type="radio"]的样式
对于表单,input[type="radio"] 的样式总是不那么友好,在不同的浏览器中表现不一. 为了最大程度的显示出它们的差别,并且为了好看,首先定义了一些样式: <fo ...
- 原生javascript自定义input[type=radio]效果
2018年6月27日 更新 找到最为简单的仅仅使用css3的方案 <!DOCTYPE html> <html lang="en"> <head> ...
随机推荐
- jquery实现表单验证与页面加载之后执行渲染
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- C# form 传参数的几个方法
方法一:传值最先想到的,Form2构造函数中接收一个string类型参数,即Form1中选中行的文本,将Form2的TextBox控件的Text设置为该string,即完成了Form1向Form2的传 ...
- crack Tut.ReverseMe1.exe
测试文件:https://www.wocloud.com.cn/webclient/share/sindex.action?id=i9K_Br6TgE7ZLB3oBGUcJmKcRy5TUdZ8U6_ ...
- JavaScript设计模式-组合模式(表单应用实现)
书读百遍其义自见 <JavaScript设计模式>一书组合模式在表单中应用,我问你答答案. 注:小编自己根据书中的栗子码的答案,如有错误,请留言斧正. 另:如有转载请注明出处,谢谢啦 &l ...
- Ubuntu系统安装配置tensorflow开发环境
Ubuntu系统安装 下载ubuntu iso 选择目前最新的版本是 Ubuntu 18.04 LTS .下载地址: 官网:https://www.ubuntu.com/download/deskto ...
- UIView与CALayer 区别
在iOS中,你能看得见摸得着的东西基本上都是UIView,比如一个按钮.一个文本标签.一个文本输入框.一个图标等等,这些都是UIView. 其实UIView之所以能显示在屏幕上,完全是因为它内部的一个 ...
- React(6) --双向数据绑定及列表数据循环
React双向数据绑定:model改变影响view,view改变反过来影响model import React,{Component} from 'react'; class Todolist ext ...
- linux--mysql的安装与配置
linux centos下,mysql安装有三种方式:二进制tar包安装,rpm安装,yum安装(最简单) 查看有没有安装过: yum list installed mysql* rpm -qa | ...
- 如何去除inline-block的默认间距
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title&g ...
- postcss-px-to-viewport 的 exclude 配置无效
原来是由于版本太低的缘故: postcss-px-to-viewport 0.0.3版本不支持 exclude属性. 更新到 1.1.0 配置: // 路径中包含 PC ,则忽略 px转换为vw,vh ...