Want text input to turn green when box is checked

Link to the project or level:(App Lab - Code.org)
What I expect to happen: When the checkbox is checked, the text input should go green
What actually happens: [replace with a detailed description of what actually happens when the code runs including any errors or unexpected behavior]
What I’ve tried: If/else statement

You should listen for the checkboxes being clicked, using onEvent, and when they are clicked, check if the boxes are checked or not, then apply the logic. Since there are multiple checkboxes, the easiest way is to make a function that registers an onEvent and call that function from a loop.

Here’s what I did after erasing all the code from line 82:

function listenForClick(i){
  onEvent("checkbox"+i,"click",function(){ // when clicked
    if (getChecked("checkbox"+i)){ // if checked
      setProperty("ToDoText"+i,"text-color",rgb(0,128,0)); // set text color to green
    } else { // if not checked
      setProperty("ToDoText"+i,"text-color",rgb(216,255,167)); // set text color to original color

// loop that calls listenForClick for each all the checkboxes
for (var i=1; i<8; i++){

By the way, the second parameter to playSound is false by default, so you do not have to manually type false for every call. Also, the text color for checkbox1 is already green.