简体   繁体   中英

Replace div based on selected dropdown using Jquery

I want to replace the languages in my div when I select a country.. Here's what I got so far but is not working

My fiddle is in the comment, i cant seem to past it here

Two changes you need to do 1. value should be 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>

and

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM