I make the assumption that you want to switch the class using the checkbox.
$('input').change(function(){ var $this = $(this), $div = $('div.menuitem'); if( $this.is(':checked') ) { $div.addClass('show'); } else { $div.removeClass('show'); } }).change();
I updated this to offer a solution to the @Rails release issue, given the comments I have read so far.
Note the addition of change() to the last line. This will force change to execute immediately when the page loads (I assume $('input') waiting for document.ready or after creating input:checkbox ).
zzzzBov
source share