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> ...
随机推荐
- 2019-9-2-win10-uwp-标题栏
title author date CreateTime categories win10 uwp 标题栏 lindexi 2019-09-02 12:57:38 +0800 2018-2-13 17 ...
- 2018-2-13-win10-UWP-RSS阅读器
title author date CreateTime categories win10 UWP RSS阅读器 lindexi 2018-2-13 17:23:3 +0800 2018-2-13 1 ...
- How To Find Out Attachments By File Type In Outlook?
ext: (extension extension) Take the attachments of zip files and of txt files for example, just ente ...
- Morphia开发简介
1. 什么是Morphia Morphia是一个开放源代码的对象关系映射框架,它对MongoDB数据库 java版驱动进行了非常轻量级的对象封装,使得Java程序员可以随心所欲的使用对象编程思维来操纵 ...
- golang-练习3
题目:将输入的字母变成其下一个字母,并且元音字母大写 package main import "fmt" func LetterChanges(str string) string ...
- 洛咕P4180 严格次小生成树
鸽了很久的一道题(?)貌似是去年NOIP前听的emm... 首先我们分析一下最小生成树的性质 我们kruskal建树的时候呢是从小到大贪心加的边,这个的证明用到拟阵.(我太菜了不会) 首先我们不存在连 ...
- Halo(十一)
Spring Boot 继承 AbstractErrorController 实现全局异常处理 @RequestMapping("${server.error.path:${error.pa ...
- boost heap
1. using boost::heap::priority_queue #include <boost/heap/priority_queue.hpp> #include <ios ...
- 英语单词retrieve
retrieve 来源——报错信息 [root@centos65 ~]# yum whatprovides */lsb_release Loaded plugins: fastestmirror, s ...
- Angular JS - 7 - Angular JS 常用指令2
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...