3 dropdown Wypełnij na podstawie wyboru w innym [Cascading dropdown]

Jestem nowy w skrypcie Java. Mam tutaj przykład pracy dla 2 rozwijanychSkrzypce .

HTML:

<select id=a></select>
<select id=b></select>
<select id=c></select>

JavaScript:

var data = [ // The data
    ['ten', [
        'eleven','twelve'
    ]],
    ['twenty', [
        'twentyone', 'twentytwo'
    ]]
];

$a = $('#a'); // The dropdowns
$b = $('#b');

for(var i = 0; i < data.length; i++) {
    var first = data[i][0];
    $a.append($("<option>"). // Add options
       attr("value",first).
       data("sel", i).
       text(first));
}

$a.change(function() {
    var index = $(this).children('option:selected').data('sel');
    var second = data[index][2]; // The second-choice data

    $b.html(''); // Clear existing options in second dropdown

    for(var j = 0; j < second.length; j++) {
        $b.append($("<option>"). // Add options
           attr("value",second[j]).
           data("sel", j).
           text(second[j]));
    }
}).change(); // Trigger once to add options at load of first choice

Daj mi znać, jak dodać jeszcze jedną listę rozwijaną w tym kodzie.

Dzięki

questionAnswers(1)

yourAnswerToTheQuestion