将复选框勾选图片更改为自定义图片 [英] Change checkbox check image to custom image
本文介绍了将复选框勾选图片更改为自定义图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图改变css的复选框的默认框图像,但它不工作。这是否有任何方式?
I am trying to change the default 'box image' of the checkbox with css, but it is not working. Is there any way arround this?
<input type="checkbox" class="class_checkbox">
并且在类文件中我
.class_checkbox{
background: url("../images/button_bullet_normal.png") no-repeat scroll 0 0 transparent;
}
推荐答案
Try:
<input type="checkbox" class="input_class_checkbox">
jQuery
$('.input_class_checkbox').each(function(){
$(this).hide().after('<div class="class_checkbox" />');
});
$('.class_checkbox').on('click',function(){
$(this).toggleClass('checked').prev().prop('checked',$(this).is('.checked'))
});
小提琴:
http://jsfiddle.net/cn6kn/
这篇关于将复选框勾选图片更改为自定义图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文