I'm facing an issue with my jQuery code where the CSS changes are not working as expected. When I test the code, it doesn't apply the CSS changes. If I remove the :checked and just use $("input"), then the CSS works but only when clicking on an input checkbox.
$("input :checked").toggle(function() {
// Code to execute every odd click;
$(this).siblings('a').css("text-decoration","line-through");
$(this).siblings('a').css("color","#aaa");
$(this).parent('li').css("background-color","#ccc");
}, function() {
// Code to execute every even click;
$(this).siblings('a').css("text-decoration","none");
$(this).siblings('a').css("color","");
$(this).parent('li').css("background-color","");
});
Can anyone help me figure out what I might be missing?