Skip to content

Instantly share code, notes, and snippets.

@kkemple
Created November 27, 2013 23:08
Show Gist options
  • Save kkemple/7684657 to your computer and use it in GitHub Desktop.
Save kkemple/7684657 to your computer and use it in GitHub Desktop.
code to create a sudo checkbox, this way you can add any styling you like
/**
* author kkemple@pixafy.com
*/
(function( $ ) {
$('body').on('click', '.check-style', function() {
var self = $( this );
var checkbox = self.children( 'input[type="checkbox"]' );
if( $( checkbox ).prop('checked') ) {
$( checkbox ).prop( 'checked', false );
$( self ).css({
'background-position': '0 0'
});
} else {
$( checkbox ).prop( 'checked', true );
$( self ).css({
'background-position': '0 -21px'
});
}
});
})( jQuery );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment