title: jQuery colorbox - get url parameter from clicked link
body: <p>I am using Colorbox to load a contact form within an iframe.</p>
  
  <p>However, I want the Colorbox url to be different than the html one, to serve up a different contact page for JS and non-JS users. </p>
  
  <p>I do need to get the url parameter from the exact clicked link though.</p>
  
  <p>HTML Code:</p>
  
  <pre><code>&lt;a href="contact?id=XX" class="enquiryForm"&gt;
  </code></pre>
  
  <p>Colorbox code:</p>
  
  <pre><code>$(document).ready(function(){
  
  $('.enquiryForm').colorbox({height:600, width:800, iframe:true, href: 'colorboxcontact?id=XX'});
  
  });
  </code></pre>
  
  <p>Where 'contact' is the non-JS page and 'colorboxcontact' is the page to be loaded in the Colorbox iframe.</p>
  
  <p>How can I extract the url parameter from the <strong>clicked</strong> link, and then add it to the 'colorboxcontact' href value in my jQuery call?</p>
  
  <p><strong>* EDIT *</strong></p>
  
  <p>Ok I've arrived at the following but still don't have it working. Can anyone point out where I am going wrong?</p>
  
  <pre><code>$('.enquiryForm').colorbox({
      height:600, 
      width:800, 
      iframe:true, 
        href: $('.enquiryForm').each(function() {
          newhref = 'colorboxcontact' + $(this).attr('href').split("?")[3];
          $(this).attr('href', newhref);
      });
    });
  </code></pre>