title: Change the color of text with a dynamic checkbox
body: <p>I'm working on a to do list. I can enter text within a field and create a new item with a checkbox, but I cannot get the checkbox to do anything. I would like to change the color of the text once the checkbox has been clicked</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function todoadd() {
      todoNew = new objectTodo();
  }
  
  function objectTodo() {
      var todo = document.getElementById('textinput').value;
      var listItem = document.createElement("li");
      var checkbox = document.createElement("input")
      checkbox.type = "checkbox";
      listItem.appendChild(checkbox);
      var itemText = document.createTextNode(todo);
      listItem.appendChild(itemText);
      document.getElementById('place').appendChild(listItem);
   
   function changeColor(checkbox,itemText) {
    var check = document.getElementById(checkbox);
    var todoItem = document.getElementById(itemText);
     if (check.checked == true) {
     todoItem.style.backgroundColor="Red";
     }
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;title&gt;ToDo&lt;/title&gt;
  
  &lt;body&gt;
  &lt;div id="container"&gt;
    &lt;div id="todoList"&gt;
       &lt;div id="textboxBackground"&gt;
      &lt;input type='text' id='textinput' placeholder='What do you need to do today?' /&gt;
      &lt;button type='button' id="myButton" class='button' onclick='todoadd()' value='Add to list' /&gt;Add To-do&lt;/button&gt;
     &lt;/div&gt;
     &lt;ul id="place"&gt;&lt;/ul&gt;
    &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>