var currentpath = location.pathname; $('.block a[@href="' + currentpath + '"]').parent().addClass('current');