STC_NEW_APP / script.js
Presidor1's picture
Upload 5 files
78d1f81 verified
Raw History Blame Contribute Delete
815 Bytes
document.addEventListener("DOMContentLoaded", () => {
const stateSelect = document.getElementById("state");
const lgaSelect = document.getElementById("lga");
const lgas = {
Adamawa: ["Yola", "Shelleng", "Mubi"],
Borno: ["Maiduguri", "Biu", "Jere"],
Kano: ["Fagge", "Dala", "Nassarawa"]
};
stateSelect.addEventListener("change", () => {
const selectedState = stateSelect.value;
lgaSelect.innerHTML = '<option value="">Select LGA</option>';
if (lgas[selectedState]) {
lgas[selectedState].forEach(lga => {
const option = document.createElement("option");
option.value = lga;
option.textContent = lga;
lgaSelect.appendChild(option);
});
}
});
});