使用 Jquery 根据选定的下拉列表替换 div



我想在选择国家/地区时替换div 中的语言。这是我到目前为止得到的,但没有工作

我的小提琴在评论中,我似乎无法在这里过去

您需要执行的两个更改 1. 值应为 1,2,3

<ul class="country-list" id="country-list" onchange="getval(this);">
<li value="1" class="Germany">Germany</li>
<li value="2" class="Singapore">Singapore</li>
<li value="3" class="Philippines">Philippines</li>
</ul>

$(".country-list li").click(function() {
$('#country-dropdown').text($(this).text());
$('#country-dropdown').click();
console.log(('.d'+$(this).val()));
$('.lang').hide();
$('.d'+$(this).val()).show();
});

最新更新