I have this code:
<script>
var paesi = ["Austria","Belgium","Bulgaria","Croatia","Cyprus","Czech Republic","Denmark","Estonia","Finland","France","Germany","Greece","Hungary","Ireland","Italy","Latvia","Lithuania","Luxembourg","Malta","Netherlands","Poland","Portugal","Romania","Slovakia","Slovenia","Spain","Sweden","United Kingdom"];
var sel = document.getElementById('country');
for (var i = 0; i < paesi.length; i++) {
var opt = document.createElement('option');
opt.innerHTML = paesi[i];
opt.value = paesi[i];
sel.appendChild(opt);
}
this array is in:
<div id="seleziona-nazione"><span><strong>Seleziona nazione</strong></span></div>
<br /><br /> <br /><br />
<select id="country"></select>
<button id="button1">seleziona</button>
I want that when I click button1
the text in selectedbox
was read and then I can do some actions. I try like this, but doesn't work:
function scelta() {
document.getElementById("button1").addEventListener("click", function (paesi) {
if (document.getElementById('country').text = 'Austria') {
myLatLng = { lat: 47.516231, lng: 14.550072 };
centra();
};
});
};
myLatLng
is a global variables. Can someone help me?