title: Setting a cookie based on the name of the link that is clicked
body: <p><strong>TLDR</strong> When clicking on a link I want to assign a cookie with a name of instrument and a value of the text on the link clicked.</p>
  
  <p>Using Jquery.1.4.2.min.js, Jquery.cookie.1.0.js</p>
  
  <hr>
  
  <p>I am trying to create a cookie when a link is clicked (will always link to "page.html").</p>
  
  <p>name of instrument</p>
  
  <p>value of the TEXT</p>
  
  <p>So far I am trying to use:</p>
  
  <pre><code>&lt;script type="text/javascript" src="scripts/jquery-1.4.2-min.js"&gt;&lt;/script&gt; 
  &lt;script type="text/javascript" src="scripts/jquery.cookie-1.0.js"&gt;&lt;/script&gt;  
  </code></pre>
  
  <p>Link1:</p>
  
  <pre><code>&lt;a href="page.html"&gt;link1&lt;/a&gt;
  </code></pre>
  
  <p>Link2:</p>
  
  <pre><code>&lt;a href="page.html"&gt;link2&lt;/a&gt;
  </code></pre>
  
  <p>Script:</p>
  
  <pre><code>$('a[href=page.html]').click(function()
  {
  var name = 'instrument';
  var value = $(this).text();
  $.cookie(name, value, { expires: 365 });
  });
  </code></pre>
  
  <p>When I click the link it just loads the link and no cookie is set.
  Debugging with firebug, firecookie, firequery. No cookie for instrument or anything along the lines is found. Onload I'll hit the </p>
  
  <p>"<code>&lt;a href="page.html"&gt;projects&lt;/a&gt;</code>" but not the</p>
  
  <p>"<code>$.cookie(name, value, { expires: 365 });</code>" at all.</p>
  
  <p>Even using the below: (Thanks to <a href="https://stackoverflow.com/users/139459/sarfraz">Sarfraz</a>)</p>
  
  <pre><code>$('a[href="page.html"]').click(function(e)
  {
   // prevent default action
   e.preventDefault();
   var name = 'instrument';
   // get link text
   var value = $(this).text();
   // set cookie
   $.cookie(name, value, { expires: 365 });
   // now go to link's location
   document.location.href = $(this).attr('href');
  });
  </code></pre>
  
  <p>Still will not create the cookie.</p>
  
  <p>If I add a breakpoint onto <code>$.cookie~</code> even on clicking one of the links it does not hit the 
  breakpoint nor the <code>document.location.href~.</code></p>
  
  <p>For Zack:</p>
  
  <p>Pre Render - 
  <code>&lt;script type="text/javascript" src="http://localhost/tree"&gt;&lt;/script&gt;</code> </p>
  
  <p>After Render - </p>
  
  <pre><code>"&lt;div class="dtree"&gt;
  &lt;div class="dTreeNode"&gt;&lt;img alt="" src="Images/base.png" id="id0"&gt;&lt;a onclick="javascript: d.s(0);" href="home" class="node" id="sd0"&gt;Home&lt;/a&gt;&lt;/div&gt;"
  </code></pre>