JSFiddle - React, Tailwind, and code Playground
by chridam
HTML
<select name="webmenu" id="webmenu" onchange="myChangeFunction(this)">
<option value="UK" id="UK_button" title="assets/images/uk_flag.png">this is the uk</option>
<option value="US" id="US_button" title="assets/images/us_flag.png">this is the us</option>
<option value="EU" id="EU_button" title="assets/images/euro_flag.png">this is the eu</option>
</select>
JavaScript
function myChangeFunction(e){
var myselect = document.getElementById("webmenu");
var country = e.value;
switch (country) {
case 'UK':
alert('Hello UK');
break;
case "EU":
alert("Hi EU");
break;
case "US":
alert("Hi America!");
break;
}
}