【前端】input radio多选事件获取所有选中的id,radio样式优化可修改
$("#all_button").on('click', function() {
obj = document.getElementsByClassName("input_radio_checked");
str = "";
for(i = 0; i < obj.length; i++) {
str += obj[i].id + " "; //这里是数字之间的空格
}
console.log(str)
alert(str)
})
radio样式优化css
<!--新增选择-->
<div class="fl radio"><input id="2" class="input_radio" type="radio" name="2" value=""><label for="2"></label></div>
<!---->
css如下:
.radio{
position: relative;
line-height: 30px;
margin-top: 1.4rem;
margin-left: 0.6rem;
}
.radio{
position: relative;
line-height: 30px;
margin-top: 1.4rem;
margin-left: 0.6rem;
}
input[type="radio"] {
width: 20px;
height: 20px;
opacity: 0;
}
label {
position: absolute;
left: 5px;
top: 3px;
width: 20px;
height: 20px;
border-radius: 50%;
border: 1px solid #999;
}
/*设置选中的input的样式*/
/* + 是兄弟选择器,获取选中后的label元素*/
.top_color {
background-color: #fe6d32;
border: 1px solid #fe6d32;
}
.top_color::after {
position: absolute;
content: "";
width: 5px;
height: 10px;
top: 3px;
left: 6px;
border: 2px solid #fff;
border-top: none;
border-left: none;
transform: rotate(45deg)
}
效果:

【前端】input radio多选事件获取所有选中的id,radio样式优化可修改的更多相关文章
- jq获取被选中的option的值。jq获取被选中的单选按钮radio的值。
温故而知新,一起复习下jq的知识点. (1) jq获取被选中的option的值 <select id="select_id"> <option value=&qu ...
- JQuery 判断checkbox是否选中,checkbox全选,获取checkbox选中值
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- checkbox的选中、全选、返选、获取所有选中的值、所有的值、单选全部时父选中
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...
- bootstarp treeview 获取勾选和获取Selected选中
在用treeview的时候,经常会遇到一些官网没有详细说明的东西,比如获取勾选和获取选中的方法,获取选中官网是有明显说明的, 如下 : $('#resourceTree').treeview('get ...
- vue 通过绑定事件获取当前行的id
<div @click="router(items.productId)" style="float: left;" :key='items.produc ...
- jquery单选框radio绑定click事件实现和是否选中的方法
使用jquery获取radio的值,最重要的是掌握jquery选择器的使用,在一个表单中我们通常是要获取被选中的那个radio项的值,所以要加checked来筛选,比如有以下的一些radio项: 1. ...
- JQuery判断radio(单选框)是否选中和获取选中值
一.设置选中方法 代码如下: $("input[name='名字']").get(0).checked=true; $("input[name='名字']"). ...
- 【jQuery获取下拉框select、单选框radio、input普通框的值和checkbox选中的个数】
radio单选框:name属性相同 <input type="radio" id="sp_type" name="p_type" va ...
- 获取radio点击事件
获取radio点击事件,不能用click(),而是用change(). $('input[name="options"]').change(function(){ console. ...
随机推荐
- ZOJ - 3818 字符串
思路:对于"ABABA"可以先枚举"AB",然后检查下一个串是否等于"AB",剩下的串就是A,最后检查A和B是否相等:对于"ABA ...
- soj4538: ShouHuXueJie Problem DFS
类似八皇后,暴力深搜. 其实我觉得这题目叙述不是很好,如果答案为0呢,难道不输出? AC代码: #include<cstdio> #include<cstring> #incl ...
- mybatis与spring的整合(使用接口实现crud)
本人刚刚接触mybatis,今天把它和spring整合起来用了一个上午==. 一开始是通过配置文件来配置,后来尝试用了一下注解,觉得mybatis的注解真的有点恶心...一大坨的,所以我还是建议使用配 ...
- 【前端】Vue2全家桶案例《看漫画》之六、图片阅读页
转载请注明出处:http://www.cnblogs.com/shamoyuu/p/vue_vux_app_6.html 项目github地址:https://github.com/shamoyuu/ ...
- 【转载】使用SDL播放YUV图像数据(转)
SDL提供了针对YUV格式数据的直接写屏操作.废话不多说,直接上代码吧/** * file showyuv.c * author: rare * date: 2009/12/06 * email: d ...
- discuz 更换域名 导致qq登录不能用的问题
今天论坛换了域名,导致qq登录不能用.于是各种百度,终于找到了解决方案,特此记录一下 解决方法:1,首先清空你站点的id和key,并且设置为未注册云平台: 2,找一个新域名(未开过云平台的就可),如果 ...
- 安装coreseek cannot find input file: src/Makefile.in 错误解决方法
安装coreseek 出现了cannot find input file: src/Makefile.in 解决方法如下 >autoheader >automake --add-missi ...
- HighCharts之气泡图报错
HighCharts之气泡图报错 具体报错如下: uncaught exception: Highcharts error #17: www.highcharts.com/errors/17 ...
- 从VGA到GPU!细数二十年显卡发展历程
VGA有很多层涵义,本来是用于代表一个分辨率(您可能不了解VGA,但应该知道QVGA代表什么),随后被普遍称为显示输出接口.为了输出VGA分辨 率.提供VGA输出接口,显卡和VGA就有了不解之缘,显卡 ...
- ASP.NET MVC 中@Html.Partial,@Html.Action,@Html.RenderPartial,@Html.RenderAction
1.Action.RenderAction加载办法的视图,履行Controller → Model → View的次序,然后把产生的页面带回到本来的View中再回传.而Partial.RenderPa ...