获取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 的一些操作的更多相关文章

  1. jquery radio、 checkbox、 select 操作

    转载:http://www.haorooms.com/post/checkandselect $("input[id^='code']");//id属性以code开始的所有inpu ...

  2. angularjs checkbox 框的操作

    前言:今天遇到一个问题,需要对多选按钮进行操作,作为js菜鸟,只能做自己慢慢琢磨了-- <label class="checkbox-inline custom-checkbox no ...

  3. jQuery对checkbox的各种操作

    //注意: 操作checkbox的checked,disabled属性时jquery1.6以前版本用attr,1.6以上(包含)建议用prop //1.根据id获取checkbox $("# ...

  4. 获取checkbox 的选中状态的id、checkbox的一些操作

    var id_array=new Array(); $('input[name="id"]:checked').each(function(){ id_array.push($(t ...

  5. 【js】操作checkbox radio 的操作总结

    摘要 总是忘记checkbox radio 的具体操作,总是坑自己,总结下记下来 html <input type="checkbox" value="1" ...

  6. jQuery判断checkbox是否选中?操作checkbox(不)选中?

    HTML      <form action="">          <input type="checkbox" name="c ...

  7. jquery checkbox的相关操作——全选、反选、获得所有选中的checkbox

    1.全选 $("#btn1").click(function(){ $("input[name='checkbox']").attr("checked ...

  8. gridview+checkbox的各种操作【转】

    来源:http://hi.baidu.com/heavensxq/item/29736dcfbdc30403c710b2b1 1.首先如何在gridview中加入一个checkbox,注意不是chec ...

  9. jq实现对checkbox的常用操作

    场景1:点击checkbox 其他checkbox被选中的都取消  (意思是只能选中一个checkbox) function fn(obj,event){ //obj就是这个this这个对象 ,eve ...

  10. 优秀前端工程师必备: 非常常用的checkbox的骚操作---全选和单选demo

    提要: 前端开发的时候, 经常会遇到表格勾选, 单个勾选判断是否全选的事情.趁着有时间, 总结一下以备不时之需! 就像下面这个栗子: 1 源代码: h5 // 全选框 <input type=& ...

随机推荐

  1. Python爬虫之post请求

    暑假放假在家没什么事情做,所以在学习了爬虫,在这个博客园里整理记录一些学习的笔记. 构建表单数据(以http://www.iqianyue.com/mypost 这个简单的网页为例) 查看源代码,发现 ...

  2. Date、DateFormat、Calendar、Math、System

    Date(基本已过时了,被Calendar替换) 构造方法(有两个) Date(); Date(long l);long类型的毫秒值 常用方法(其他方法都已被Calendar替换) getTime() ...

  3. python之路之模块

    subprocess模块 复杂命令 logging模块(重点) 日志模块,线程安全

  4. 哥廷根: Heroes in My Heart

    哥廷根: Heroes in My Heart (本篇的文字部分均出自北大未名BBS的连载 Heroes in my heart 中哥廷根的部分,作者 ukim. 话说,有任何人能够联系上 ukim ...

  5. Apache Kafka(七)- Kafka ElasticSearch Comsumer

    Kafka ElasticSearch Consumer 对于Kafka Consumer,我们会写一个例子用于消费Kafka 数据传输到ElasticSearch. 1. 构造ElasticSear ...

  6. Go操作influxDB

      influxDB 安装 下载 https://portal.influxdata.com/downloads/ 这里需要注意因为这个网站引用了google的api所以国内点页面的按钮是没反应的,怎 ...

  7. 使用 navigator.sendBeacon() 上报数据

    http://kaifage.com/notes/76/navigator-sendBeacon.html 如某些统计系统,在页面unload时,如果要上报当前数据,采用xhr的同步上报方式,会阻塞当 ...

  8. HTML学习(10)图像

    HTML图像标签<img>,没有闭合标签 <img src="" alt="" width="" height=" ...

  9. [RedHat]“is not in the sudoers file”解决方法

    当在终端执行sudo命令时,系统提示“luckchengis not in the sudoers file”: $ sudo ls Password: luckcheng is not in the ...

  10. JarvisOJ - Writeup(5.31更新)

    此篇用来记录我在jarivsOJ上的一些题解,只给解题思路,不放flag Misc 0x01 You Need Python(300) 题目有两个文件,一个py文件,另一个是经过编码的key 文件ke ...