Hello, I am trying to get my javascript to recognise a folder on each page. Depending on the folder name, I would like to Add that folder name to my innerHTML with if else statements. I'm having trouble getting it to to function with an if else, else if, else statement.
Here is the HTML snippet:
<div id="countryVal"></div>
And the javascript:
var outputData = document.getElementById('clothingVal');
if (window.location.search.search(/Men/)) {
document.getElementById('clothingVal');
outputData.innerHTML = outputData.innerHTML + ': ' + 'Australia';
}
else if (window.location.search.search(/Women/)) {
document.getElementById('clothingVal');
outputData.innerHTML = outputData.innerHTML + ': ' + 'New Zealand';
}
else {outputData.innerHTML = outputData.innerHTML + ': ' + '';
};
Any suggestions would be very much appreciated.