I need 2 list dropdown, follow this tutorial https://www.w3schools.com/howto/howto_js_cascading_dropdown.asp
and i need delete 1 dropdown from declare in javascript, result sub dropdown number, not string text.
var subjectObject = {
"Bể gom": {
"pH": ["1 OK","2 OK"],
"COD": ["4 OK","5 OK"]
}, "ERROR list":
["not SHOW", "not SHOW2", "not SHOW3"]
}
window.onload = function () {
var subjectSel = document.getElementById("subject");
var topicSel = document.getElementById("topic");
for (var x in subjectObject) {
subjectSel.options[subjectSel.options.length] = new Option(x, x);
}
subjectSel.onchange = function () {
//empty Chapters- and Topics- dropdowns
//chapterSel.length = 1;
topicSel.length = 1;
//display correct values
for (var y in subjectObject[this.value]) {
topicSel.options[topicSel.options.length] = new Option(y, y);
}
}
}