ricardozea
1/31/2013 - 8:19 PM

jQuery: Add/remove a class to labels with checkboxes and radio buttons and style them

jQuery: Add/remove a class to labels with checkboxes and radio buttons and style them

//Add/remove a class to labels with checkboxes and radio buttons and style them
$('label input[type=radio], label input[type=checkbox]').click(function() {
  $('label:has(input:checked)').addClass('active');
  $('label:has(input:not(:checked))').removeClass('active');
});