title: jquery function with parameters
body: <p>i have several checkboxes that when checked show a hidden div.  Is there a way to write a jquery function that will show or hide based on whether the checkbox is checked the hidded div?</p>
  
  <p>using just javascript </p>
  
  <pre><code>&lt;input type="checkbox" name="box1" id="box1" onclick="function toggle('div1')"&gt;
  &lt;div id='div1'&gt;
  .....
  &lt;/div&gt;
  
  &lt;input type="checkbox" name="box2" id="box2" onclick="function toggle('div2')"&gt;
  &lt;div id='div2'&gt;
  .....
  &lt;/div&gt;
  
  
  &lt;script&gt;
  function toggle(id) {
  if (this.checked) show(id);
  else hide(id);
  }
  </code></pre>
  
  <p>where <code>show()</code> and <code>hide()</code> are functions define to change the display attribue of the id.</p>
  
  <p>Is there some way to do this in jquery where I bind the toggle to the checkbox adn have it toggle an id that is passed somehow?</p>