title: if check box is checked display div
body: <p>I'm trying to build something like wordpress options for toggling fields visibility when creating and article. What I've build is relying on the <code>$.click</code> function that is toggling the parent with the corresponding field name and I was wondering what would be the best way of doing this with if the check box is checked because my code will mess up if you check a box and reload the page because its a click and not if the box is actually checked. Thanks in advance!</p>
  
  <p><a href="http://jsfiddle.net/zgrRd/1/" rel="nofollow">http://jsfiddle.net/zgrRd/1/</a></p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;input type="checkbox" name="title"&gt;
  &lt;span class="caption"&gt;Title&lt;/span&gt;
  
  &lt;div class="hidden"&gt;
    &lt;h2&gt;Title&lt;/h2&gt;
    &lt;input type="text" name="title"&gt;
    &lt;span class="caption"&gt;Lorem&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>jQuery</strong></p>
  
  <pre><code>$('input[type="checkbox"]').click(function(){
      var item = $(this).attr('name');
      $('input[name="'+item+'"][type="text"]').parent().toggle();
  });
  </code></pre>