title: How to add toggleClass to a checked checkbox with jQuery?
body: <p>I append some input textfields and checkboxes onclick. 
  But when a checkbox is checked i want to toggleClass to the input textfield.
  This is my create code:</p>
  
  <pre><code>jQuery(function() {
  var counter = 0;
  
  $('#appendbtn').click(function() {
      var elems = '&lt;div&gt;' + '&lt;input type="checkbox" id="checkbox"' + (counter) + '" class="item"/&gt;' + '&lt;input type="text" id="inputfield"' + (counter) + '"/&gt;' + '&lt;/div&gt;';
      $('#box').append(elems);
      counter++;
      return false;
  });
  </code></pre>
  
  <p>This is what should happen;</p>
  
  <pre><code>if ($("#checkbox").is(":checked"))
   {
  $("inputfield" + counter).toggleClass("complete")
   });
  </code></pre>
  
  <p>Ofcourse this isn't correct, but i hope you get what i mean ;)
  is this by the way possible without an if statement?</p>
  
  <p>here is the jsfiddle <a href="http://www.jsfiddle.net/gkdKY/" rel="nofollow">http://www.jsfiddle.net/gkdKY/</a></p>
  
  <p>oh and this is exactly what i want <a href="http://www.jsfiddle.net/xzmcL/" rel="nofollow">http://www.jsfiddle.net/xzmcL/</a>
  but with appended checkboxes!</p>