var currentURL = $(location).attr('href'); var currentSite = $(location).attr('href').replace($(location).attr('pathname'), ''); var siteStr = currentURL.replace(currentSite, ''); var subSite = siteStr.substring(1, 3).toUpperCase(); if (subSite == "HR") { // here is my code if subsite = HR } else if (subSite == "IT") { // here is my code if subsite = IT } else { // here is my code if subsite is other than IT and HR }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)