function populate(s1, s2) {
var s1 = document.getElementById(s1);
var s2 = document.getElementById(s2);
s2.innerHTML = "";
if (s1.value == "Faculty of Arts, Humanities and Social Sciences") {
var optionArray = ["|", "schoolOfArt|School of Art", "schoolOfArtsAndHumanities|School of Arts and Humanities", "schoolOfCommunicationAndMedia|School of Communication and Media", "schoolOfEducation|School of Education", "schoolOfLaw|School of Law", "schoolOfAppliedSocialAndPolicySciences|School of Applied Social and Policy Sciences"];
} else if (s1.value == "Faculty of Computing, Engineering and the Built Environment") {
var optionArray = ["|", "schoolOfComputing|School of Computing", "schoolOfComputingEngineeringAndIntelligentSystems|School of Computing, Engineering and Intelligent Systems", "schoolOfEngineering|School of Engineering", "School of Architecture and the Built Environment|schoolOfArchitectureAndTheBuiltEnvironment"];
} else if (s1.value == "Faculty of Life & Health Sciences") {
var optionArray = ["|", "schoolOfBiomedicalSciences|School of Biomedical Sciences", "schoolOfGeographyEnvironmentalSciences|School of Geography & Environmental Sciences", "schoolOfHealthSciences|School of Health Sciences", "schoolOfNursing|School of Nursing", "schoolOfPharmacyAndPharmaceuticalSciences|School of Pharmacy & Pharmaceutical Sciences", "schoolOfPsychology|School of Psychology", "schoolOfSport|School of Sport"];
} else if (s1.value == "Ulster University Business School") {
var optionArray = ["|", "departmentOfAccountingFinanceAndEconomics|Department of Accounting, Finance and Economics", "departmentOfGlobalBusinessAndEnterprise|Department of Global Business and Enterprise", "departmentOfHospitalityTourismManagement|Department of Hospitality & Tourism Management", "departmentOfManagementLeadershipAndMarketing|Department of Management, Leadership and Marketing"];
}
for (var option in optionArray) {
var pair = optionArray[option].split("|");
var newOption = document.createElement("option");
newOption.value = pair[0];
newOption.innerHTML = pair[1];
s2.options.add(newOption);
}
}
<html>
<body>
<h2>Select your Faculty:</h2>
<hr/> Choose Faculty:
<select id="select1" name="select1" onchange="populate('select1', 'select2')">
<option value=""></option>
<option value="Faculty of Arts, Humanities and Social Sciences"></option>
<option value="Faculty of Computing, Engineering and the Built Environment"></option>
<option value="Faculty of Life & Health Sciences"></option>
<option value="Ulster University Business School"></option>
</select>
<hr/> Choose School:
<select id="select2" name="select2"></select>
<hr/>
</body>
</html>