Untitled

mail@pastecode.io avatar
unknown
javascript
a month ago
407 B
3
Indexable
Never
document.querySelector("select#departamento")?.addEventListener("change", function (e) {
    if (e.target.value === "CU") {
        const options = document.querySelectorAll("select#ciudad option")
        options.forEach(function(op) {
            if (op.value === "Bogota"){
                op.value = "Bogota, D.C."
                op.innerText = "Bogota, D.C."
            }
        })
    }
        
})
Leave a Comment