Created
June 14, 2013 14:42
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('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