2

ページの機能を変更するはずのドロップダウンがありますが、明らかに機能していません。ユーザーが選択すると、ドロップダウン選択にマップが表示され、業界がマップを更新し、下の凡例を更新することになっています。凡例が更新されていません

私が間違っていることを指摘してください。

ありがとうございました

JS

    $("#lstMap1Occ").change(function () {
        var index = $(this).children(":selected").index();
        $("#legend").children().hide().eq(index).show();
    });

ここにドロップダウンがあります(はい、最後の選択タグがありますが、奇妙な理由で貼り付けられていません)

<select id="lstMap1Occ">
    <option value="1">Engineers </option>
    <option value="2">Chemical Engineers</option>
</select>

HTML

<div class="legend">
<div class="engineers">
    <ul>
        <li style="background-color:rgb(254,240,217);">0-345</li>
        <li style="background-color:rgb(253,212,158);">346-503</li>
        <li style="background-color:rgb(253,187,132);">504-1240</li>
        <li style="background-color:rgb(252,141,89);">1241-1679</li>
        <li style="background-color:rgb(239,101,72);">1680-2625</li>
        <li style="background-color:rgb(215,48,31);">2627-4789</li>
    </ul>
</div>
<div class="chemical"> 
    <ul>
        <li style="background-color:rgb(254,240,217);">0-13</li>
        <li style="background-color:rgb(253,212,158);">14-24</li>
        <li style="background-color:rgb(253,187,132);">25-37</li>
        <li style="background-color:rgb(252,141,89);">38-56</li>
        <li style="background-color:rgb(239,101,72);">57-112</li>
        <li style="background-color:rgb(215,48,31);">113-168</li>
    </ul>
</div>

4

1 に答える 1

1

.legend ではなく #legend http://jsfiddle.net/fy6hf/1/

$("#lstMap1Occ").change(function () {
        var index = $(this).children(":selected").index();
        $(".legend").children().hide().eq(index).show();
    });
于 2013-07-11T18:26:24.193 に答える