-1

と があるこの HTML コードがありdivますbutton

ここで、jQuery を使用してdiv「非表示」を作成し、正しい .xml を選択した場合にのみ表示されます<option>。しかし、今でbuttonは があまりにもある場合にのみ表示divされます。

HTML:

<div id="great">
    Do you like the netherlands?
    <input type="text" id="greatBox" value="Why..."
</div>

<input type="button" id="submitbutton" value="Submit">

JS / Jqueryは次のようになります

(ファイル全体に広がり、残りは必要ありません(推測))

$('#great').hide()

$("#selectlist").change(function(){
    var value = $(this).val();
    if ($(this).val() ==  "netherlands") { 
        $('#great').slideDown(750)
        $('#other').hide()
    }
    if ($(this).val() == "other") { 
        $('#great').hide()
    }
});

ボタンにバインドされた jQuery/javascript はまだありません。

4

1 に答える 1

1

あなたは閉じる必要があります<input type="text" id="greatBox" value="Why..." >

開いているため、divが閉じられることはなく、その後のすべてが非表示になります。

于 2012-11-28T12:43:41.260 に答える