I am trying to add a class when a checkbox is checked.
My jquery:
$(\'input\').attr(\"checked\").change(function(){ $(\'div.menuitem\').addClass(\"me
Try this:
$('input').change(function(){ if ($(this).is(':checked')) { $('div.menuitem').addClass("menuitemshow"); } });
You cannot have a change event on an attribute, instead check the change event of the checkbox itself and run a condition to see if it's been checked.