Clicking on label doesn't trigger click event
This would be safer to use:
$(function() {
$('input[type="checkbox"]').bind('change', function (v) {
if($(this).is(':checked')) {
$(this).parent().addClass('active');
} else {
$(this).parent().removeClass('active');
}
});
});
Using change
instead of click
allows for people that navigate forms using the keyboard.