You need to wrap it inside of an event; specifically, a change()
event, to listen out for when the checked
property of the input is changed:
$("#flip-checkbox-4").change(function(){
if($("#flip-checkbox-4").is(":checked")) {
$(".text-left").css("color", "grey");
$(".text-right").css("color", "blue");
} else {
$(".text-left").css("color", "blue");
$(".text-right").css("color", "grey")
}
});
A shorter way to do this:
$("#flip-checkbox-4").change(function(){
$(".text-left").css("color", this.checked ? "grey" : "blue");
$(".text-right").css("color", this.checked ? "blue" : "grey");
});