title: active navbar button when is clicked using jquery and cookie
body: <p>I'm trying to put active a navbar button when it's clicked,  but I can't have a correct solution.  I have this:</p>
  
  <pre><code>var cookieValue=$.cookie("nav");
  
  $('.nav.navbar-nav &gt; li').on('click', function() {
      $.removeCookie("nav");
      $.cookie("nav", $('a',this).attr("id"), { expires: 7, path: '/' });
      var cookieValue = $.cookie("nav");
  });
  if(cookieValue)
  {
      $('#' + cookieValue).addClass('active');
  }
  </code></pre>
  
  <p>where cookieValue is the ID of the button.</p>