title: Add click event to Div and go to first link found
body: <p>I think I've been too much time looking at this function and just got stuck trying to figure out the nice clean way to do it.</p>
  
  <p>It's a jQuery function that adds a click event to any <code>div</code> that has a <code>click</code> CSS class. When that <code>div.click</code> is clicked it redirects the user to the first link found in it.</p>
  
  <pre><code>function clickabledivs() {
      $('.click').each(
          function (intIndex) {
              $(this).bind("click", function(){
                  window.location = $( "#"+$(this).attr('id')+" a:first-child" ).attr('href');
              });
          }
      );
  }
  </code></pre>
  
  <p>The code simply works although I'm pretty sure there is a fairly better way to accomplish it, specially the selector I am using: <code>$( "#"+$(this).attr('id')+" a:first-child" )</code>. Everything looks long and slow. Any ideas? </p>
  
  <p>Please let me know if you need more details. </p>
  
  <p>PS: I've found some really nice jQuery benchmarking reference from Project2k.de here: 
  <a href="http://blog.projekt2k.de/2010/01/benchmarking-jquery-1-4/" rel="nofollow noreferrer">http://blog.projekt2k.de/2010/01/benchmarking-jquery-1-4/</a></p>