关于 checkbox 的一些操作
获取checkbox选中的状态
$("#checkbox").is(":checked");
设置 checkbox 的状态
$("#checkbox").attr("checked", true);//设置为选中状态
$("#checkbox").attr("checked", false);//设置为未选中状态
用css对checkbox进行样式修饰


这是效果图
<div class="checkbox" style="height: 21px;">
<input id="remember" type="checkbox" name="">
<label for="remember"></label>
</div>
.checkbox {
height: 21px;
line-height: 21px;
font-size: 13px;
margin-top: 0px !important;
margin-bottom: 0px !important;
}
.checkbox input[type="checkbox"] {
opacity: ;
z-index: ;
width: 20px;
height: 20px;
}
.checkbox label {
display: inline-block;
position: relative;
padding-left: 5px;
}
.checkbox label::before {
content: "";
display: inline-block;
position: absolute;
width: 18px;
height: 18px;
left: -13px;
top: -13px;
margin-left: -14px;
border: 1px solid #cccccc;
border-radius: 3px;
-webkit-transition: border .3s ease-in-out, color .3s ease-in-out;
-o-transition: border .3s ease-in-out, color .3s ease-in-out;
transition: border .3s ease-in-out, color .3s ease-in-out;
}
.checkbox label::after {
content: '';
position: absolute;
left: -21px;
top: -12px;
width: 6px;
height: 12px;
border: ;
border-right: 3px solid #fff;
border-bottom: 3px solid #fff;
transform: rotate(45deg);
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-webkit-transition: border .3s ease-in-out, color .3s ease-in-out;
-o-transition: border .3s ease-in-out, color .3s ease-in-out;
transition: border .3s ease-in-out, color .3s ease-in-out;
}
.checkbox input[type="checkbox"]:checked + label::before {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
background-color: #4d8bfc;
border-color: #4d8bfc;
}
.checkbox input[type="checkbox"]:checked + label::after {
background-color: #4d8bfc;
}
关于 checkbox 的一些操作的更多相关文章
- jquery radio、 checkbox、 select 操作
转载:http://www.haorooms.com/post/checkandselect $("input[id^='code']");//id属性以code开始的所有inpu ...
- angularjs checkbox 框的操作
前言:今天遇到一个问题,需要对多选按钮进行操作,作为js菜鸟,只能做自己慢慢琢磨了-- <label class="checkbox-inline custom-checkbox no ...
- jQuery对checkbox的各种操作
//注意: 操作checkbox的checked,disabled属性时jquery1.6以前版本用attr,1.6以上(包含)建议用prop //1.根据id获取checkbox $("# ...
- 获取checkbox 的选中状态的id、checkbox的一些操作
var id_array=new Array(); $('input[name="id"]:checked').each(function(){ id_array.push($(t ...
- 【js】操作checkbox radio 的操作总结
摘要 总是忘记checkbox radio 的具体操作,总是坑自己,总结下记下来 html <input type="checkbox" value="1" ...
- jQuery判断checkbox是否选中?操作checkbox(不)选中?
HTML <form action=""> <input type="checkbox" name="c ...
- jquery checkbox的相关操作——全选、反选、获得所有选中的checkbox
1.全选 $("#btn1").click(function(){ $("input[name='checkbox']").attr("checked ...
- gridview+checkbox的各种操作【转】
来源:http://hi.baidu.com/heavensxq/item/29736dcfbdc30403c710b2b1 1.首先如何在gridview中加入一个checkbox,注意不是chec ...
- jq实现对checkbox的常用操作
场景1:点击checkbox 其他checkbox被选中的都取消 (意思是只能选中一个checkbox) function fn(obj,event){ //obj就是这个this这个对象 ,eve ...
- 优秀前端工程师必备: 非常常用的checkbox的骚操作---全选和单选demo
提要: 前端开发的时候, 经常会遇到表格勾选, 单个勾选判断是否全选的事情.趁着有时间, 总结一下以备不时之需! 就像下面这个栗子: 1 源代码: h5 // 全选框 <input type=& ...
随机推荐
- abb画学号
MODULE Module2 VAR signaldi signaldi26; VAR signaldi signaldi37; VAR signaldi signaldi48; PROC main2 ...
- POJ3273 Monthly Expense (二分最小化花费)
链接:http://poj.org/problem?id=3273 题意:FJ想把n天分成m组,每组是连续的,同一组的花费加起来算,求所分组情况中最高花费的最低值 思路:二分答案.二分整数范围内的花费 ...
- ORM表单操作
准备工作: 1.在orm操作表单之前需要先修改下django中连接的数据库,默认连接的是SQLit3,这里我们修改成mysql 2.mysql使用的版本是5.6,已经安装好了,直接连接就可以使用 创建 ...
- winform学习(4)控件的添加、显示和隐藏
窗体的添加.显示与隐藏 可以直接通过工具栏将某个控件直接拖动至UI界面(也可以在工具栏里双击某个控件) 也可以在代码里直接添加:窗体的标识.Controls.Add(控件标识符); Button my ...
- Module build failed: TypeError: this.getResolve is not a function at Object.loader sass报错!(亲测有效!~~)
vue安装node-sass编译报错 在搭建vue脚手架 或者是在vue项目中,想使用sass的功能,需先安装如下 npm install node-sass --save-dev //安装node- ...
- vue-cli 3 脚手架搭建(create)
地址:https://cli.vuejs.org/zh/guide/ 安装步骤: 提示:node 版本要 8.9+ 两种方式: (1) npm install -g @vue/cli (2) yarn ...
- 公有IP和私有IP的区别
什么是IP? 在网络中,每台计算机都有一个唯一的地址,方便别人找到它,这个地址称为IP地址 IP地址是一个网络编码,用来确定网络中的一个节点,是由32位的二进制组成 IP地址的组成? IP地址由网络部 ...
- 计算几何-BZOJ2618-凸包的交-HPI
This article is made by Jason-Cow.Welcome to reprint.But please post the article's address. bzoj2618 ...
- C 语言实现面向对象编程
转载 https://blog.csdn.net/onlyshi/article/details/81672279 C 语言实现面向对象编程1.引言面向对象编程(OOP)并不是一种特定的语言或者工具, ...
- 【游戏体验】Haunted House(鬼屋历险记)
>>>点此处可试玩无敌版<<< 这款游戏可谓是经典,很多人的童年都有过它的陪伴,不妨重拾当年的快乐 个人测评 游戏性 9/10 音乐 7/10 剧情 4/10 总评 ...