复选框样式自定义

一、HTML部分

<label class="check_list i_check">
    <input name="checkbox" type="checkbox" class="checkbox">
</label>

二、CSS部分

.check_list{
	float: left;
}
.checkbox{
	opacity: 0;
	filter:alpha(opacity=0);
	cursor: pointer;
}
.i_check{
	background: url(imgs/复选框1.png) no-repeat;
}
.i_check:hover{
	background: url(imgs/复选框hover.png) no-repeat;
}
.i_checked{
	background: url(imgs/复选框-选中.png) no-repeat;
}

三、jq部分

$(".checkbox").click(function (){
					//判断复选框勾选状态
					if ($(this).is(':checked')) {
					$(this).parent().removeClass("i_check").addClass("i_checked");    //删除未勾选选背景
					}else{
					$(this).parent().removeClass("i_checked").addClass("i_check");
					}
				});
原文地址:https://www.cnblogs.com/yigexiaojiangshi/p/6940891.html