获取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. monkey log 处理

    Monkey结果输出 1.保存在pc中 adb shell monkey [option] <count> >d:\monkey.txt 2.保存在手机中 adb shell mon ...

  2. POJ 3264 Balanced Lineup(ST模板)

    链接:http://poj.org/problem?id=3264 题意:给n个数,求一段区间L,R的最大值 - 最小值,Q次询问 思路:ST表模板,预处理区间最值,O(1)复杂度询问 AC代码: # ...

  3. springmvc的框架搭建及工作流程

    1.搭建要点 web.xml: <servlet-mapping>     <servlet-name>springDispatcherServlet</servlet- ...

  4. istio部署-istio jaeger & kiali

    参考 fleeto/sleep fleeto/flaskapp jaegertracing/jaeger kiali kiali/kiali kiali/kiali-ui kiali/kiali/ta ...

  5. Java.util.Calendar类

    Java.util.Calendar类 package myProject; import java.text.SimpleDateFormat; import java.util.Calendar; ...

  6. 2019-08-01 纪中NOIP模拟B组

    T1 [JZOJ2642] 游戏 题目描述 Alice和Bob在玩一个游戏,游戏是在一个N*N的矩阵上进行的,每个格子上都有一个正整数.当轮到Alice/Bob时,他/她可以选择最后一列或最后一行,并 ...

  7. k8s集群应用例如jenkins启动问题排查思路

    k8s集群应用例如jenkins启动问题排查思路 待办 rancher上的事件报告>pods日志>pods内容器日志(现获取容器id再查看容器日志,获取容器id 使用的是相应问题pod的名 ...

  8. 【C语言】数组名作函数参数,完成数据的升序排列

    #include<stdio.h> void sort(int x[],int n); int main() { ] = { ,,,,,,,,, },i; sort(arr, ); pri ...

  9. 【vue store的使用方法】(this.$store.state this.$store.getters this.$store.dispatch this.$store.commit)

    vue 页面文件 <template> <div> {{this.$store.state.count}}<br/> {{count}}<br/> {{ ...

  10. Git的基本使用 -- 创建本地仓库

    下载安装 Git-2.25.0-64-bit .exe 查看是否安装成功 git --version 创建本地仓库 创建一个文件夹用于存放项目文件 在创建好的文件中右键选择 Git Bash Here ...