关于 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=& ...
随机推荐
- thinkphp中路由的基本使用
1.在application中下的config.php中 以下代码改为true // 是否开启路由 'url_route_on' => true, // 是否强制使用路由 'url_route_ ...
- sql语句代码规范
19年年底的时候领导一直强调代码规范化以前写代码的时候很随意后来越来越看自己写的代码难受逐渐的也像规范化走去,今天又学了一招记录分享一下 这张图就是以前写代码的时候正常情况很是杂乱无章 这张就是规范话 ...
- 简单了解一个WSDL,SOAP的格式
简单了解一个WSDL,SOAP的格式 2016-06-20 09:34:43 树先生i 阅读数 5187 收藏 更多 分类专栏: WebService 版权声明:本文为博主原创文章,遵循CC 4 ...
- zabbix_agentd无法启动,cannot open log 错误
最近有一台服务器的zabbix启动异常,看日志有如下报错 zabbix_agentd []: cannot open log: cannot create semaphore ] No space l ...
- D. Game with modulo 交互题(取余(膜)性质)附带a mod b<a/2证明
D. Game with modulo 交互题(取余(膜)性质) 题意 猜一个点\(a\)可以向机器提问 点对\((x,y)\) 如果\(x\mod(a)>=y\mod(a)\)回答\(x\) ...
- 【转载】Win7下如何使用GCC编译器
转自:http://jingyan.baidu.com/article/c275f6bacc0126e33c756771.html 双击GCC安装包,mingw-get-setup.exe,点击Ins ...
- zookeeper linux分布式部署
安装包下载地址:http://mirror.bit.edu.cn/apache/zookeeper,记住要下载那个bin的不要下tar.gz包不然即使你安装了也会报错误: 找不到或无法加载主类org. ...
- [Python]python中assert和isinstance的用法
assert语句是一种插入调试断点到程序的一种便捷的方式. assert == assert == True assert ( == ) print('-----------') assert ( = ...
- kuangbin专题 专题九 连通图 POJ 1236 Network of Schools
题目链接:https://vjudge.net/problem/POJ-1236 题目:有向图,有若干个连通图,点之间有单向边边就可以单向传递信息,问: (1)至少需要发送几份信息才能使得每个点都传递 ...
- VMware 搭建linux虚拟机环境
1.任务管理器-服务 确认VMware服务是否启动 2.VMware生成网关地址 编辑--虚拟网络编辑器 VMnet8 NAT设置子网IP,子网掩码,网关 3.windows网络--更改适配器设置-- ...