Can I get some help to perform some functions when a user selects an item in dropdown list?
First, below code shows a dropdown with locales one can select from.
Code that shows a dropdown with different locales:
<p>Please select a locale.</p>
<div class="dropdown">
<button onclick="myFunction()" class="dropbtn">Locales</button>
<div id="locale" class="dropdown-content">
<a href="#enUS">en-US</a>
<a href="#jaJP">ja-JP</a>
<a href="#deDE">de-DE</a>
</div>
<script>
function myFunction() {
document.getElementById("locale").classList.toggle("show");
}
</script>
And now if a user selects en-US from dropdown, it will need to perform a function that shows different data based on the selected locale like below. If a user selects ja-JP, it will perform the same thing based on 'ja-JP' locale.
Intl.DateTimeFormat('en-US').format(new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
Intl.NumberFormat('en-US').format(1234.56));
Thank you!