title: Dynamic toggle function with jquery?
body: <p>I'm trying to create a flexible toggle function with jQuery where I take the ID of the item to be toggled as a parameter. the function is triggered by a link which passes the correct ID to the function.</p>
  
  <p>here is the code at the moment:</p>
  
  <pre><code>function boldToggler(itemid){
  $(itemid).toggle(function(){
      $(itemid).css("font-weight","bold");},
  function(){
      $(itemid).css("font-weight","normal");});
  }
  </code></pre>
  
  <p>which is triggered by links like this:</p>
  
  <pre><code>&lt;a href="javascript: boldToggler('h1')"&gt;toggle style for this item&lt;/a&gt;
  &lt;a href="javascript: boldToggler('h2')"&gt;toggle style for this item&lt;/a&gt;
  </code></pre>
  
  <p>is there a way to get this to work? it would save me writing hundreds of toggle functions!</p>
  
  <p>Any help would be amazing, thanks</p>