$("#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样式优化可修改的更多相关文章

  1. jq获取被选中的option的值。jq获取被选中的单选按钮radio的值。

    温故而知新,一起复习下jq的知识点. (1) jq获取被选中的option的值 <select id="select_id"> <option value=&qu ...

  2. JQuery 判断checkbox是否选中,checkbox全选,获取checkbox选中值

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  3. checkbox的选中、全选、返选、获取所有选中的值、所有的值、单选全部时父选中

    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...

  4. bootstarp treeview 获取勾选和获取Selected选中

    在用treeview的时候,经常会遇到一些官网没有详细说明的东西,比如获取勾选和获取选中的方法,获取选中官网是有明显说明的, 如下 : $('#resourceTree').treeview('get ...

  5. vue 通过绑定事件获取当前行的id

    <div @click="router(items.productId)" style="float: left;" :key='items.produc ...

  6. jquery单选框radio绑定click事件实现和是否选中的方法

    使用jquery获取radio的值,最重要的是掌握jquery选择器的使用,在一个表单中我们通常是要获取被选中的那个radio项的值,所以要加checked来筛选,比如有以下的一些radio项: 1. ...

  7. JQuery判断radio(单选框)是否选中和获取选中值

    一.设置选中方法 代码如下: $("input[name='名字']").get(0).checked=true; $("input[name='名字']"). ...

  8. 【jQuery获取下拉框select、单选框radio、input普通框的值和checkbox选中的个数】

    radio单选框:name属性相同 <input type="radio" id="sp_type" name="p_type" va ...

  9. 获取radio点击事件

    获取radio点击事件,不能用click(),而是用change(). $('input[name="options"]').change(function(){ console. ...

随机推荐

  1. 转 Caffe学习系列(5):其它常用层及参数

    本文讲解一些其它的常用层,包括:softmax_loss层,Inner Product层,accuracy层,reshape层和dropout层及其它们的参数配置. 1.softmax-loss so ...

  2. jquery源码分析之一前言篇

    1.问:jquery源码分析的版本是什么? 答:v3.2.1 2.问:为什么要分析jquery源码? 答:javascript是一切js框架的基础,jquery.es6.vue.angular.rea ...

  3. 跨站请求伪造攻击 CSRF

    摘录: 1.跨站点请求伪造 首先,什么是跨站点请求伪造? 跨站点请求伪造-CSRF(Cross Site Request Forgery):是一种网络攻击方式. 说的白话一点就是,别的站点伪造你的请求 ...

  4. vue项目中对axios的二次封装

    近来在使用vue重构公司m站时,使用了axios来进行数据的请求,由于项目的需要,对axios进行了二次封装,点击进入axios //引入axios import axios from 'axios' ...

  5. probabilistic robotics_bayes filter

    贝叶斯滤波 执行测量后的后验概率: 执行测量前的先验概率: 执行测量后的后验概率推导 根据式2.23的推导方式 可推出 假定xt是complete,即xt可以完全决定测量结果,那么则有2.56式: 带 ...

  6. Android WebView 缓存机制和模式详解

    当我们加载Html时候,会在我们data/应用package下生成database与cache两个文件夹: 我们请求的Url记录是保存在webviewCache.db里,而url的内容是保存在webv ...

  7. dojo报错总结

    dojo报错总结 1.错误一 neteaseTracker is not defined dojo.js(第15行) 2.错误二 _10 is undefined _SearchMixin.js(第5 ...

  8. R语言︱大数据集下运行内存管理

    在实操时出现以下的问题: Error: cannot allocate vector of size 2.9GB 大神指导(http://bbs.pinggu.org/thread-3682816-1 ...

  9. HighCharts之2D柱状图、折线图的组合多轴图

    HighCharts之2D柱状图.折线图的组合多轴图 1.实例源码 SomeAxis.html: <!DOCTYPE html> <html> <head> < ...

  10. Java Web项目(Extjs)报错八

    1.Java Web项目(Extjs)报错八 具体报错如下: org.springframework.dao.DataIntegrityViolationException: Could not ex ...