Hello trying to write jquery that when l select a direction from my html drop down menu it provides an alert saying the name of direction l chose. Tried the below code but seems to not work
$(document).ready(function() {
//selection for combobox...
$('#mydirection').change(function (e){
doOnChange(e)
})
});
function doOnChange(myObj){
if (typeof console == "E"){
console.log("Change on selection");
console.log(myObj);
}
alert("You chose East");
if (typeof console == "W"){
console.log("Change on selection");
console.log(myObj);
}
alert("You chose west");
if (typeof console == "N"){
console.log("Change on selection");
console.log(myObj);
}
alert("You chose north");
if (typeof console == "S"){
console.log("Change on selection");
console.log(myObj);
}
alert("You chose south");
}
function updateStatusBox(img, msg) {
document.getElementById('statuscaption').innerHTML = msg;
document.getElementById('event_image').src = img;
}
<p>Please select a direction:<br/>
<select id="mydirection" name="direction">
<option value="N">North</option>
<option value="S">South</option>
<option value="E">East</option>
<option value="W">West</option>
</select>
</p>