Spaces:
Running
Running
File size: 815 Bytes
78d1f81 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
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);
});
}
});
});
|