Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

292
Views
Javascript Two Dropdown Lists cascading dependent MVC5

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.

Result not string from array

         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);
            }          
        }        
    }

https://codepen.io/ConanKLOP/pen/KKQeWjq

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!