$(function () { $('.hidden-link-innen').each(function () { if(window.location == $(this).data('link')) { $(this).addClass('active'); } }); });