Skip to content

Instantly share code, notes, and snippets.

@kezabelle
Created June 14, 2013 14:42
Show Gist options
  • Save kezabelle/5782398 to your computer and use it in GitHub Desktop.
Save kezabelle/5782398 to your computer and use it in GitHub Desktop.
A reminder to myself about how to mark up wrapped checkboxes when they change ... could do with being cleverer, I expect.
$('input[type="checkbox"]').live('change', function(evt) {
var $this = $(this);
var $parent = $this.parent();
if ($this.attr('checked') === true) {
$parent.addClass('selected').removeClass('unselected');
return true;
} else {
$parent.removeClass('selected').addClass('unselected');
return false;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment