<ul class="menu">
<li><a href="#">lel</a></li>
<li><a href="#">lol</a></li>
<li><a href="#">kek</a></li>
<li><a href="#">cheburek</a></li>
</ul>
$(document).ready(function() {
$('ul.menu a').each(function () {
if (this.href == location.href) $(this).parent().addClass('active');
});
});
<a href="#someLink">somelink</a>
(this.href == location.href)
(this.hash == location.hash)