title: Adding class in parent <li> if it's the current location with Coffeescript
body: <p>I've tried to use this code but it returns 'undefined'.</p>
  
  <pre><code>(($) -&gt; 
      $('li.menu-item a').each (index, element) -&gt;
          if $(element).attr('href') == $(location).attr('href')
              $(element).parent().addClass('selected');
  ) jQuery
  </code></pre>
  
  <p>Here follows my HTML code:</p>
  
  <pre><code>&lt;nav class="menu"&gt;
      &lt;ul&gt;
          &lt;li class="menu-item"&gt;&lt;a href="&lt;?php bloginfo( 'url' ); ?&gt;"&gt;Home&lt;/a&gt;&lt;/li&gt;
          &lt;li class="menu-item"&gt;&lt;a href="#"&gt;&lt;/a&gt;&lt;/li&gt;
          &lt;li class="menu-item"&gt;&lt;a href="#"&gt;&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
  &lt;/nav&gt;
  </code></pre>