jQuery(document).ready(function($){ /* SUB MENU */ var subMenuList = $("#subsidebar .sidebar-list-con"); $(subMenuList).children().each(function(){ var address = $(this).find("a").attr("href"); if(address.match(window.location.pathname)){ //if($(this).find("a").attr("href").match(window.location.pathname)){ $(this).addClass('selected'); } }) })