2つの選択ドロップダウンを作成し、divを表示/非表示にしました。しかし、2つの別々のドロップダウンから選択される2つの値に応じてdivをベースにしたい。JQuery - 2つの異なる選択ドロップダウン値に基づいてDIVSを表示しない
つの値に基づいてDIV /ショーの非表示を表示するために、私は選択肢番号2
$(document).ready(function(){
$("select").change(function(){
$(this).find("option:selected").each(function(){
if($(this).attr("value")=="bfcn")
{
$(".discount-info").not(".bfcn").hide();
$(".bfcn").show();
}
else{
$(".discount-info").hide();
}
});
})
.change();
});
HTML
<div>
<select>
<option>Where are you travelling to?</option>
<option value="bfcn">Belfast</option>
<option value="bflp">Liverpool</option>
</select>
<select class="peak">
<option>What month are you travelling in?</option>
<option value="offpeak">March, April, May, September</option>
<option value="peak">July, August</option>
</select>
</div>
<div class="bfcn discount-info">
<div class="content"> PDF LINK HERE </div>
</div>
私は混乱している:
は、ここに私のデモHTMLです。あなたはhtmlを投稿して、いつどのHTMLを隠したいのかを説明できますか? – hackerhasid