So I have styled checkboxes with CSS and a sprite using this markup:
<div class="open-checkbox">
<label class="open-checkbox">
<input id="<?php echo $id; ?>" class="key-areas-checkbox" name="interests[]" type="checkbox" value="<?php echo $label; ?>" />
</label>
</div>
and this JS:
$(".key-areas-checkbox:checked").each(function(){
$(this).next().addClass('checked');
});
$('.open-checkbox').click(function () {
console.log('click');
var $this = $(this);
var $input = $this.find('input');
$this.toggleClass('checked', $input.is(':checked'));
return;
if($input.prop('checked')){
$this.removeClass('checked');
} else {
$this.addClass('checked');
}
});
And this works in all browsers except IE8 and IE7. Does anyone know how to make this work in those browsers? FYI - the inputs are hidden. I noticed that if I made visibility:visible, checked the checkbox, then hid it again, it displays properly.