Trying to replace and hide certain elements based on the subdomain. Example if the url is “www.uownrealestate.com” then load the normal site but if it is “justin2.uownrealestate.com” then hide the element containing an anchor link with the text “Agents”.
$(document).ready(function() {
var option = 'justin2';
var full = window.location.host
//window.location.host is subdomain.domain.com
var parts = full.split('.')
var subDomain = parts[0]
var domain = parts[1]
if (subDomain == option) {
showDiv();
}
});
function showDiv() {
$("li:has(a:contains('Agents'))").hide();
}
EDIT
$(document).ready(function() {
var option = 'justin2';
var full = window.location.host
if(full.indexOf(option) > -1){
showDiv();
}
});
function showDiv() {
$("li:has(a:contains('Agents'))").hide();
}
still nothing is happening. any other suggestions? also this script is in an external js file. that shouldnt matter at all correct? Here is a snippit of the li element.
<li><a href="only-at-uown.html">Only at uOwn</a>
<ul>
<li><a href="showing-simulations.html"><span> Showing Simulations</span></a></li>
<li><a href="3d-mapping.html"><span> 3D Mapping</span></a></li>
<li><a href="solar-signs.html"><span> Solar-Powered Yard Signs</span></a></li>
<li><a href="paper-free-office.html"> Paper-Free Offices</a></li>
<li><a href="prestige-package.html"> Prestige Package</a></li>
<li><a href="only-at-uown.html"> <em>Much more...</em></a></li>
</ul>
</li>
<li><a href="realtors-agents.html">Agents</a></li>
<li><a href="3d-showcase.html">3D Showcase</a></li>
Try using
.indexOf(