Hello,
I'm creating a form, and we want the checkbox choices labels to have a line-through if they are unchecked and no line-through when they are checked. I have created a CSS class for the strike-through and then thought I would use JavaScript to add or remove the class depending on whether or not the box is checked. Below is my code, but I can't get it to work. The line-through stays even if the box is checked. I would appreciate any help as I'm pretty new to JavaScript and don't know if this is possible.
/*CSS Class for strike through*/
.strike label {
text-decoration: line-through;
}
Java Script
$(document).ready(function(){
$(input[type='checkbox'].each(function() {
$(this).click(function() {
if($(this).is(":checked")){
$(this).removeClass('.strike');
} else {
$(this).addClass('.strike');
}
});
});
});