【前端】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. ...
随机推荐
- KV型内存数据库Redis
Redis是开源的高性能内存Key-Value数据库, 可以提供事务和持久化支持, 并提供了TTL(time to life)服务. Redis采用单线程数据操作+非阻塞IO的模型,非阻塞IO提供了较 ...
- scrapy回调函数传递参数
scrapy.Request 的callback传参的两种方式 1.使用 lambda方式传递参数 def parse(self, response): for sel in response.xpa ...
- B+索引、Hash索引、数据类型长度
1.为什么在数据库中要用B树索引而不是Hash索引? Mysql Hash索引结构的特殊性,其检索效率非常高,索引的检索可以一次定位,不像B-Tree 索引需要从根节点到枝节点,最后才能访问到页节点这 ...
- 【Unity3D】Unity3D开发《我的世界》之一、创建一个面
转载请注明出处:http://www.cnblogs.com/shamoyuu/p/unity_minecraft_01.html 最近总有人问及我的游戏里跟<我的世界>一样的地形是如何实 ...
- ubuntu下串口编程备忘
弄了一下串口,一个小问题多折腾了下,备忘.软件环境:zl@zhanglong:~$ cat /etc/lsb-release DISTRIB_ID=UbuntuDISTRIB_RELEASE=12.0 ...
- 基于嵌入式操作系统VxWorks的多任务并发程序设计(1)――基本概念
1引言 嵌入式系统定义义为:嵌入到对象体系中的专用计算机系统."嵌入性"."专用性"与"计算机系统"是嵌入式统的三个基本要素,对象系统则是指 ...
- freemarker自定义标签(三)-nested指令
freemarker自定义标签 1.nested指令 是可选的,可以在<#macro>和</#macro>之间使用在任何位置和任意次数 2.示例说明 <#macro ta ...
- hi3531的h264压缩中修改波特率
typedef struct hiVENC_ATTR_H264_CBR_S { HI_U32 u32Gop; HI_U32 u32StatTime; HI_U32 u32ViFrmRate; HI_F ...
- Error creating bean with name 'com.you.user.dao.StudentDaoTest': Injection of autowired dependencies
1.错误描述 七月 13, 2014 6:37:41 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBean ...
- 利用MD5加密字符串
private static string MD5E(string temp) { MD5 md5 = new MD5CryptoServiceProvider(); byte[] source=Sy ...