My complete JavaScript code is https://jsfiddle.net/JSstarter/0t98gbg3/. Dropdown list worked, but after I add setFormat function, the dropdown list stops working and it doesn't show the list of locales. Can someone please help me how to fix the JavaScript part to get the dropdown list and also the setFormat function to work?
<p id="demo">Please select a locale to show data.</p>
<div class="dropdown">
<button onclick="myFunction()" class="dropbtn">Locales</button>
<div id="locale" class="dropdown-content">
<a href="#enUS" onclick="setFormat('en-US')">en-US</a>
<a href="#koKR" onclick="setFormat('ko-KR')">ko-KR</a>
<a href="#zhCN" onclick="setFormat('zh-Hans-CN')">zh-Hans-CN</a>
<a href="#jaJP" onclick="setFormat('ja-JP')">ja-JP</a>
<a href="#deDE" onclick="setFormat('de-DE')">de-DE</a>
<a href="#ruRU" onclick="setFormat('ru-RU')">ru-RU</a>
<a href="#arSA" onclick="setFormat('ar-SA')">ar-SA</a>
</div>
</div>
<script>
function myFunction() {
document.getElementById("locale").classList.toggle("show");
}
setFormat(locale) {
var date = new Date(2016, 1, 14, 0, 0, 0);
document.getElementByID("demo").innerHTML = new Intl.DateTimeFormat('en- US').format(date);
document.getElementByID("demo").innerHTML = new Intl.NumberFormat('en-US').format(1234.56);
};
</script>